Hacker News Clone new | comments | show | ask | jobs | submit | github repologin
One Billion Nested Loop Iterations (benjdd.com)
21 points by behnamoh 2 hours ago | hide | past | web | 6 comments | favorite





Would be nice to know max RAM usage by each implementation.

It blows my mind to see that speed difference between different languages. In even the slowest language there we have lots of ways we could optimize this contrived code but this is not something that we can always do in the real world. Seeing the visualization here really underscores how fast some languages are.

It’s a billion times integer modulus, summed. Div/mod is by far the slowest arithmetic instruction on a CPU, so it underestimates C/rust performance. I guess the author chose that to prevent the C compiler from optimizing the loop away.

This does not seem like a realistic benchmark target.

Perhaps it's unrealistic in the sense that this is unrealistically-optimisable code.

Real-world code has closures, allocations, and pointer-dererencing. This code is just iterations, additions and modulus.


> This code is just iterations...

Which is what the average programmer out there writes. Therefore, I think this is actually a good realistic benchmark.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: