Repository navigation
Use rayon's thread pool. - #1202
Conversation
|
r? @kvark |
|
I am being told that it would be best to wait for servo/servo#16303 to be merged before merging this one in order to avoid having 0.6 in servo and 0.7 in webrender. |
| pub render_target_debug: bool, | ||
| pub max_texture_size: Option<u32>, | ||
| pub workers: Option<Arc<Mutex<ThreadPool>>>, | ||
| pub workers: Option<Arc<Mutex<rayon::ThreadPool>>>, |
There was a problem hiding this comment.
Do you need the mutex now? It seems the spawn_async function takes an immutable ThreadPool, so I don't see why off-hand.
|
Thanks @emilio, it's quite a lot nicer without that mutex around the thread pool! |
kvark
left a comment
There was a problem hiding this comment.
Looks great, there is a couple of notes.
| let recorder = options.recorder; | ||
| // TODO(gw): Use a heuristic to select best # of worker threads. | ||
| let worker_config = rayon::Configuration::new().thread_name(|idx|{ format!("WebRender:Worker#{}", idx) }) | ||
| .num_threads(4); |
There was a problem hiding this comment.
let's not even call num_threads?
If num_threads is 0, or you do not call this function, then the Rayon runtime will select the number of threads automatically. At present, this is based on the RAYON_RS_NUM_CPUS (if set), or the number of logical CPUs (otherwise).
| pub render_target_debug: bool, | ||
| pub max_texture_size: Option<u32>, | ||
| pub workers: Option<Arc<Mutex<ThreadPool>>>, | ||
| pub workers: Option<Arc<rayon::ThreadPool>>, |
There was a problem hiding this comment.
while I use this style in some of the personal project, I believe the convention in WR is to use all the types you need
|
@nical I marked this as [DO NOT MERGE] based on your comment #1202 (comment) - feel free to update the title when this is ready to go :) |
|
☔ The latest upstream changes (presumably #1205) made this pull request unmergeable. Please resolve the merge conflicts. |
|
servo/servo#16303 has landed. |
|
@bors-servo r+ |
|
📌 Commit 48699aa has been approved by |
Use rayon's thread pool. cf. issue #1178. Rayon's thread pool implementation is a lot better than the one provided by the threadpool crate, and comes with a lot of very useful additional features. The spawn_async functionality which we need is currently behind the unstable feature flag. Note that stylo is also using rayon with the unstable feature flag and is bumping to version 0.7 in servo/servo#16303. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1202) <!-- Reviewable:end -->
|
☀️ Test successful - status-travis |
WR update: preserve-3d support <!-- Please describe your changes on the following line: --> This is WR update to servo/webrender@d335555 having new features: - limited "preserve-3d" support (servo/webrender#1169, servo/webrender#1208) - rayon thread pool (servo/webrender#1202) - further border rendering improvements Edit: the references to bincode serialization and border styles are removed from here, since they are already integrated into Servo. Edit2: this is alternative/similar to #16801, based on @mrobinson code (see first commit). --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). Related to #9087 Note that I'm unlocking a few tests as well as changing some related to `preserve-3d`. The changes come from common sense and comparison to Chromium. I'm ready to discuss them on a individual basis. <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ There is still an investigation to do with regards to the differences of preserve3d logic between Blink and Gecko. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16775) <!-- Reviewable:end -->
Let rayon automatically choose the number of threads in the ThreadPool. This is a tiny followup from PR #1202 that I wanted to submit in isolation so that we can easily check its effect on performance (if any) and roll it back if needed. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1259) <!-- Reviewable:end -->
cf. issue #1178.
Rayon's thread pool implementation is a lot better than the one provided by the threadpool crate, and comes with a lot of very useful additional features. The spawn_async functionality which we need is currently behind the unstable feature flag. Note that stylo is also using rayon with the unstable feature flag and is bumping to version 0.7 in servo/servo#16303.
This change is