12861 shaares
326 private links
326 private links
- Stop allocating useless strings: to_string(), .clone(), HashMap borrow the string
- Optimize
hashmaplookups withhashmap.entry().or_insert(0) += 1instead of 3 lookups: in an if condition, insert operation and update. - Use as much core as possible: rewrite loops as iterators and then use rayon with
par_lines. remove()in array is a costly O(n) operation. If order is not important, preferswap_remove.