Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
If it were only the sum() or only the fold() as on stackoverflow this would be true.
But benchmarking shows that combining map() and sum() is about 10% slower.
Also, using iter() instead of into_iter() will degrade performance by another 30-40%.
Using vectors with 100 million elements on my machine:
iter + map + sum = ~3.1-3.3s
into_iter +map + sum = ~2.5-2.6s
iter + fold = ~2.9-3.1s
into_iter + fold = ~2.3-2.4s
This comment is hidden because it contains spoiler information about the solution