layout: Implement parallel reflow for the bubble-widths and

assign-heights phases.

This uses the new work-stealing deque. By default, 3/4 of a thread per
logical CPU is used. This can be tuned with the `-y` flag.

I measured a 65% reflow speedup on `perf-rainbow.html` and a 247% reflow
speedup on `http://en.wikipedia.org/wiki/South_China_Sea` on a 4-core
HyperThreaded Core i7. However, numbers were fairly volatile, especially
for the latter.
This commit is contained in:
Patrick Walton 2014-01-14 14:57:40 -08:00
parent 539cf58f73
commit 54f0f17f83
21 changed files with 706 additions and 141 deletions

View file

@ -370,11 +370,11 @@ impl ImageCache {
match self.wait_map.pop(&url) {
Some(waiters) => {
unsafe {
waiters.unsafe_access( |waiters| {
waiters.unsafe_access(|waiters| {
for response in waiters.iter() {
response.send(f());
}
})
});
}
}
None => ()
@ -404,9 +404,7 @@ impl ImageCache {
let waiters = self.wait_map.find_mut(&url).unwrap();
let mut response = Some(response);
unsafe {
waiters.unsafe_access(|waiters| {
waiters.push(response.take().unwrap());
});
waiters.unsafe_access(|waiters| waiters.push(response.take().unwrap()))
}
} else {
self.wait_map.insert(url, MutexArc::new(~[response]));