|
|
|
|
|
by bschwindHN
617 days ago
|
|
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
|
|