4 ms·
> But I also note that the original version of your benchmark was calling `println!`, which means that you were essentially benchmarking high-level, thread-safe
by burntsushi 8y ago
> But I also note that the original version of your benchmark was calling `println!`, which means that you were essentially benchmarking high-level, thread-safe I/O.
I don't think so. The program is only doing a thousand prints, which is far less than the total number of loop iterations. Try changing to locked stdout and writeln!---I doubt you'll notice a difference.
- lambda 8y agoYeah, I tried the locking version and didn't see a noticeable improvement.
- ekidd 8y agoThank you for checking this, and determining it didn't actually apply in this case. We do a lot of I/O intensive Rust at work, and I have a list of things to double-check when benchmarking. The most common slowdowns: debug builds, unlocked stdio, line iterators, and anything else which allocates in an inner loop. If I can hit 250 MB/s throughput per core on my laptop, with some light data processing, I'm usually quite happy.