mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Merge pull request #2966 from glennw/perf-rainbow
Make perf_rainbow.html load ~20x faster by making the file loader read i...
This commit is contained in:
commit
b13fc34bfd
1 changed files with 7 additions and 3 deletions
|
@ -8,8 +8,7 @@ use std::io;
|
||||||
use std::io::File;
|
use std::io::File;
|
||||||
use servo_util::task::spawn_named;
|
use servo_util::task::spawn_named;
|
||||||
|
|
||||||
//FIXME: https://github.com/mozilla/rust/issues/12892
|
static READ_SIZE: uint = 8192;
|
||||||
static READ_SIZE: uint = 1;
|
|
||||||
|
|
||||||
fn read_all(reader: &mut io::Stream, progress_chan: &Sender<ProgressMsg>)
|
fn read_all(reader: &mut io::Stream, progress_chan: &Sender<ProgressMsg>)
|
||||||
-> Result<(), String> {
|
-> Result<(), String> {
|
||||||
|
@ -18,7 +17,12 @@ fn read_all(reader: &mut io::Stream, progress_chan: &Sender<ProgressMsg>)
|
||||||
match reader.push_at_least(READ_SIZE, READ_SIZE, &mut buf) {
|
match reader.push_at_least(READ_SIZE, READ_SIZE, &mut buf) {
|
||||||
Ok(_) => progress_chan.send(Payload(buf)),
|
Ok(_) => progress_chan.send(Payload(buf)),
|
||||||
Err(e) => match e.kind {
|
Err(e) => match e.kind {
|
||||||
io::EndOfFile => return Ok(()),
|
io::EndOfFile => {
|
||||||
|
if buf.len() > 0 {
|
||||||
|
progress_chan.send(Payload(buf));
|
||||||
|
}
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
_ => return Err(e.desc.to_string()),
|
_ => return Err(e.desc.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue