You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Identfiy preallocation opportunities. For instance, replace Vec::new() with Vec::with_capacity()
Seems like most current new() cannot really preallocate due to uncertainty. The basic preallocation algorithm is optimized enough that unless we have a strong idea regarding memory access premature allocation is not helpful.
Many of these are low hanging fruit and related to refactoring the code to idiomatic Rust code.
For example, there are many for loops in this code. Iterator based code is more idiomatic, easier to improve with rayon, and interact better with allocation. (pushing items from within a for loop can cause multiple allocs and copies, while collecting an iterator can allow fewer allocations.)
As per our discussion in #2 for speed improvements the following has been suggested
The paths I had in mind was these:
RayonDashMap(CurrentstdHashMap implements rayon so not strictly necessary, but might be useful to look into regardless)Use replace hashing algorithm used in HashMapwithFxHash,AHash,HighwayHashReplaceSorting was changed to unstable #6sort()withsort_unstable()Identfiy preallocation opportunities. For instance, replaceVec::new()withVec::with_capacity()Many of these are low hanging fruit and related to refactoring the code to idiomatic Rust code.
For example, there are many for loops in this code. Iterator based code is more idiomatic, easier to improve with
rayon, and interact better with allocation. (pushing items from within a for loop can cause multiple allocs and copies, while collecting an iterator can allow fewer allocations.)