News for hackers. Stuff that matters.
Re:Fun with Go Iterators by bschwindHN on Thursday October 10, 2024 @08:02PM (#41804818)
Funny enough, the iterator version is much faster in rust because the compiler can more easily optimize iterator chains than custom for loops:

https://play.rust-lang.org/?version=stable&mode=release&edit...

(I'd recommend running it on your own machine as the rust playground limits memory and will likely kill this program)

Output from my machine:

    $ cargo run --release
        Finished `release` profile [optimized] target(s) in 0.05s
         Running `target/release/iterator`
    Process 1 returned 18270843109002848788 and took 64.58175ms
    Process 2 returned 18270843109002848788 and took 308.969083ms

There are no comments on this comment yet.