perf: ⚡️ remove extra collection when using rayon#2016
Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
|
|
||
| let index_sorted_cross_chunk_imports = index_cross_chunk_imports | ||
| .into_iter() | ||
| // FIXME: Extra traversing. This is a workaround due to `par_bridge` doesn't ensure order https://github.com/rayon-rs/rayon/issues/551#issuecomment-882069261 |
There was a problem hiding this comment.
Should keep this. What this PR does is still to be considered as a workaround.
There was a problem hiding this comment.
why this is a workaround?
There was a problem hiding this comment.
According to rayon-rs/rayon#669 (comment), the ordering now is preserved without another traverse
There was a problem hiding this comment.
There was a problem hiding this comment.
It's not about rayon here. IMO, this should be solved by the oxc_index to have a native support of rayon.
There was a problem hiding this comment.
Then that should be TODO: wait oxc_index support IntoParIterator rather than Fixme:, since the bug is fixed, no overhead needed.
| .raw | ||
| .into_par_iter() | ||
| .enumerate() | ||
| .map(|(asset_idx, mut hasher)| { |
There was a problem hiding this comment.
asset_idx become usize instead of AssetIdx, this is unexpected. I'm not sure why oxc_index allows using usize as the valid index type. But the reason we use IndexVec is to have a domain-specific Vec to prevent misusing wrong index. Otherwise we could just use std Vec.
There was a problem hiding this comment.
@overlookmotel Sorry for bothering. Could you take have a rough look if this is expected/reasonable behavior of oxc_index?
There was a problem hiding this comment.
@hyf0 Sorry I'm so late to come back on this. It got lost in my Github notifications.
I've made a PR to prevent IndexVecs being indexed into with a usize (oxc-project/oxc#5733). As you say, that's a bad idea! That oddity was inherited from index_vec crate.
Opened an issue for the par iter problem: oxc-project/oxc#5734
Benchmarks Rust |
|
TODO: is added |
Description