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.
Maybe (I'm not sure) because into_iter() actually copies i32, and iter() creates references. While references are also 32 bit on x32 arch, they are 64 bit on x64 arch. So it may cause unnecessary creation of muliple u64 pointers that slow down the whole thing.
This is really weird.
Isn't into_iter giving you a copy, while iter giving you a reference? Why is making a copy faster?
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
Actually IntStream.of() calls Arrays.stream()
From IntStream.java :