Re:The One Billion Row Challenge in Go: from 1m45s to 4s in ...
by tutfbhuf on Sunday March 03, 2024 @01:07PM
(#39582823)
Your expectation is correct. The Java version is more tuned. Here https://github.com/dhartunian/1brcgo/?tab=readme-ov-file#lea..., you can find a version that runs in 1.108 and is almost 3x better than the one you quoted. I think one can reduce it even further. In the end, it depends on how fast the executable can boot up and execute the code. At some point, JVM will lose because it takes quite some time just to initialize the JVM, whereas Go executables can boot up very fast. Here you can see a comparison of Hello World Programs: https://github.com/qznc/hello-benchmark?tab=readme-ov-file#h.... JVM takes a whopping 596 ms to boot up and print Hello World, whereas Go just requires 149 ms.
[ Parent
| on HN ]
Re:The One Billion Row Challenge in Go: from 1m45s to 4s in ...
by benhoyt on Sunday March 03, 2024 @04:13PM
(#39584600)
I think that's true with the JVM, but the fastest Java solutions are using GraalVM and its ahead-of-time compilation mode to avoid startup time. In addition, while "go run" might take 149ms to compile and run a program, a compiled Go program starts in just a couple of milliseconds:
$ time ./t
Hello, world
real 0m0.003s
Re:The One Billion Row Challenge in Go: from 1m45s to 4s in ...
by tutfbhuf on Monday March 04, 2024 @03:00AM
(#39588062)
Thank you for the insights. I would like to add that native compilation with GraalVM sounds excellent in theory, but in all the real-world Java codebases that I have tested for native compilation, it wasn't possible due to some limitations in the code or some dependency (it is not a drop-in replacement).