beardyw 12 hours ago

This is about the optimising of logic, not languages. At the bottom there are the same instructions which know nothing of the language that conjured them up. Hats off to whoever did the work on this, but let's not get confused about where the magic happens.

  • Osiris-Team 12 hours ago

    True but let's also not forget the unpredictability of stupidity in human developers which probably cause the majority of performance loss in any language.

evanjrowley 12 hours ago

>A repo dedicated to showing why Java is better than all other languages

>0 stars

The premise of the JIT compiler and optimizations leading to faster execution seems plausible. It's not the first time I've heard it either. I just thought the above two things were humorous. ;)

  • Osiris-Team 12 hours ago

    I just now created the repo for this purpose, hoped to reach some more experience C developers with it and prove me wrong.

floxy 12 hours ago

Also countPrimes() is side-effect free, and the value isn't used. So I wouldn't be surprised that at a high enough optimization level, that neither instance of countPrimes() is called for C or C++.

  • Osiris-Team 11 hours ago

    Yeah, feel free to contribute / create a PR with a more C/C++ suited algorithm.

SleepyMyroslav 12 hours ago

1BRC was quite fun read. Author really needs better benchmark if they want to get PR out of it =)

Osiris-Team 9 hours ago

I added some further optimizations and guess I was wrong!

floxy 12 hours ago

Your upper limit (1000000) needs to come from runtime (user input/file), otherwise you could create a C++ template program to compute the answer at compile time. Also, you might be interested in the Benchmarks Game:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

...where it looks like GCC C++ beats GraalVM in all the tests.

  • Osiris-Team 12 hours ago

    Do they compare the second run of Java? Because using GraalVM native image does not really benefit from runtime info and optimization.

    • floxy 11 hours ago

      I know there was a lot of teeth gnashing in the past about HotSpot warmup, and I think it mostly boiled down to not much of a difference for most tests.

Osiris-Team 12 hours ago

Feel free to create a PR on the linked repo and prove me wrong.

To add some detail: I think that 99% of algorithms are faster in Java in their second run than in any other Language due to the better JIT compiler and optimizations that are possible. I am talking about the GraalVM distribution of Java and its latest version, but we might as well use other distros.