2 ms·
And what if the runtime does poorly on even such a simple loop? Go is surprisingly slower here than Java and Kotlin. I agree with the author of the blog here -
by pkolaczk 2y ago
And what if the runtime does poorly on even such a simple loop? Go is surprisingly slower here than Java and Kotlin.
I agree with the author of the blog here - microbenchmarks are just experiments and they can be very useful if you do proper analysis of the results. You can definitely learn something about the runtimes even from such a simple for loop benchmark.
- pizlonator 2y agoAs a VM implementer, I conclude nothing from the observation that Go is slower on this test. Because it’s a bullshit loop that I wouldn’t ever write and neither would anyone else unless they were trying to troll people with nonsense “experiments”. The fact that you’re drawing information from the fact that Go is slower on this loop is just you being mislead by a bad experiment. If you want to understand Go’s performance, run some real benchmarks. My understanding is that Go is plenty fast.
- pkolaczk 2y agoA simple loop like that running slower tells that the compiler optimization strength is not really very good. If it misses optimizations of trivial code like looping and basic arithmetic, it will likely miss even more in complex code. And instead of getting defensive about your language of choice, the right reaction is what Dart developers did - they improved their compiler. The benchmark proved actually useful to them. This benchmark is not any less real than your “real world” benchmark. By being a simple micro benchmarks it may be actually even more useful than running very complex “real world” code, because it simplifies analysis.