-
-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map.traverse performance is non-linear. #1633
Comments
Thank you, that's right! We will fix it. |
@mduesterhoeft Please take a look at Map.traverse() and Multimap.traverse(). The List.append() calls are O(n) for each append. The foldLeft calls append n times => we have an overall O(n^2). There are two possibilities to solve this issue:
List has the least memory overhead but is iterated again when calling reverse(). Therefore I think we should implement 1) instead and use Vector. |
…rmance use a Vector as accumulator of map.traverse (#1633)
It appears that Map.traverse calls append instead of prepend and reverse, resulting in quadratic performance.
Timing code:
ElapsedTime just stores
System.nanoTime
and then returns the elapsed time since the constructor was called.I get these timing results:
The final traverse of 409600 entries is still running after 15 minutes.
The text was updated successfully, but these errors were encountered: