4 ms·
Also, what is he really trying to benchmark? Would it be informative to generate 10^9 random numbers and add them up, or is there a specific goal of finding how
by andy99 3y ago
Also, what is he really trying to benchmark? Would it be informative to generate 10^9 random numbers and add them up, or is there a specific goal of finding how fast a counter is incremented?
- nomilk 3y agoIt’s an arbitrary benchmark, inspired by this: https://youtube.com/watch?v=VioxsWYzoJk https://youtube.com/watch?v=VioxsWYzoJk
- andy99 3y agoI got curious and wrote it in assembly (Disclaimer, I haven't written any assembly code since university, it was mostly chatGPT). See the attached gist. This should be the gold standard for a "fair" loop, one that's actually looping in raw assembly. https://gist.github.com/rbitr/0649972657f5d0d959eeb71a5b3e0206 https://gist.github.com/rbitr/0649972657f5d0d959eeb71a5b3e02...
- Someone 3y agoThat removes the binary-to-decimal conversion of the result, which easily could take a significant fraction of running time when using a smart compiler.
- andy99 3y agoI don't think that is material, it definitely isn't for code that's actually running the loop. I did just try timing it with the pipe to hexdump and of course it makes no difference. One could do the same or just modify the code to include conversion if worried about the impact.
- nomilk 3y agoFound this fun comparison, but this time measuring development time: https://www.youtube.com/watch?v=3PcIJKd1PKU https://www.youtube.com/watch?v=3PcIJKd1PKU