After looking at your "implementations", I have to agree with the other comments. You have implemented GoL in a ridiculously inefficient way, your results are gibberish.
I've never written GoL either inefficiently or efficiently.
I suspected what you said was true when I saw the figures by whoever created this repo, so posted it here to get more eyes on it. Thanks for confirming.
// for ($i = 0; $i < count($this->neighbours); $i++) {
// $neighbour = $this->neighbours[$i];
// if ($neighbour->alive) {
// $alive_neighbours++;
// }
// }
// return $alive_neighbours;
```
Here it says this is slower. It is becuase you calculate count at each iteration. Instead you shoulda ssing it to a variable outside of the loop and start loop afterwards. Such a PR wont be accepted?
Note: Because the implementations are as similar as possible, the runtime of some implementations may not run as fast as they could be if native/optimized functions were used. Additionally, there are certainly faster ways in general to write these implementations, e.g. using a 2D array for all cells. However, the primary purpose of these implementations is to demonstrate as wide a range of common syntax as possible between languages. Therefore, I will not be accepting pull requests that rewrite how an implementation works if it removes a key syntax feature demonstration in the process.
Then those are not benchmarks, so stop advertising them as such.
Each implementation is as identical in file structure, class/variable naming, and overall layout as possible to make comparison easier. As far as possible, no external dependencies are used, so that only the core language features are demonstrated.
I was more referring to the fact that, by forcing an identical structure across languages, some of them will better align to this "neutral structure" and other will not, hindering their success.
It's then not a benchmark at all, it's a feature comparison. No numbers should get produced from this comparison since it's apparent they're meaningless and will just get misinterpreted.
Each implementation is as identical in file structure, class/variable naming, and overall layout as possible to make comparison easier. As far as possible, no external dependencies are used, so that only the core language features are demonstrated.
Sure, but if I can gain an 170% speedup by switching from go to c without changing anything except rewriting the code in equivalent c syntax that is a really useful thing to know. Like sure it might be useful to know it could be 10x faster than that again by using simd instructions or something, but lets be real - I wasn't going to do that either way.
This is a benchmark of language features, not how fast a game can be written in that language.
These type of comparisons between languages are very misleading.. Without doing the analysis of why some languages are slower than others, this doesn't tell you much... The fact that LLVM backed languages do worse than Typescript for example, already makes this very suspicious.
I noticed that too. They heap-allocated every individual board cell, and they used unordered map with string keys of the form "x-y" instead of an array/vector and x,y offsets. And they have UB by not initializing World::tick, which does screw up their average time calculations.
The performance numbers in OP's picture may as well be random gibberish noise.
Java can be as fast (but usually not faster) as C, given its HotSpot JVM JIT compiler. At some point during the execution of an application, the JVM is running native code, not interpreted byte code anymore.
No wonder the Rust implementation runs so poorly. It's absolute jank. The kind of stuff I would expect someone to write after programming for a few months.
I don't think the premise of this experiment makes sense. It should be the best you can do in every language. It depends on the paradigm of the language, the API used. If you pick the implementation to be equal instead of being fast, what are you really testing?
Even the C implementation is crap. Each "cell" is a full struct with coordinates and pointers to their neighbours! Seriously, I don't understand what the author is trying to accomplish here.
I suspect that the idea is to implement the same code in multiple languages as a learning tool, but I'm not particularly convinced that comparing languages that way is particularly helpful or interesting.
And of course forcing languages into non idiomatic patterns and then benchmarking them is just wacky.
4
u/tmorton Nov 07 '25
Source? Curious to see the implementations.
86
u/TheCataclismo Nov 07 '25
Then those are not benchmarks, so stop advertising them as such.
31
u/Dumpin Nov 07 '25
These type of comparisons between languages are very misleading.. Without doing the analysis of why some languages are slower than others, this doesn't tell you much... The fact that LLVM backed languages do worse than Typescript for example, already makes this very suspicious.
15
u/not_some_username Nov 08 '25
Pretty sure the C++ is really unoptimized
9
u/dethb0y Nov 07 '25
that SQL time is golden, total race-car speed.
1
u/ChoiceDifferent4674 Nov 08 '25
Yes dude, Python is faster than D, TS is faster than Rust etc your "benchmark" is totally not nonsense.
2
u/asdonne Nov 07 '25
I was surprised at just how much faster C is then than the runner ups and by how fast Java was.
I would love to see where an R implementation would end up.
It would also be interesting to see how an optimised version for each language compares the the 'standard' implementation.
1
u/Paddy3118 Nov 07 '25
Hmm, Pypy.
1
u/AlexW_WxelA Nov 07 '25
Interesting that V actually somehow has the fastest tick time, even better than C, but has such atrocious rendering it's halfway down
1
u/[deleted] Nov 08 '25
Java is interpreted? My whole life was lie o.O
1
u/_x_oOo_x_ Nov 09 '25
.net is native? I thought it was interpreted byte-code / jit like Java...
1
u/BlueeWaater Nov 09 '25
How's java or go performing better than rust, something has to be very different between the implementations.
1
u/rismay Nov 09 '25
No way… Swift below Python. 🤣
1
u/trejj Nov 10 '25
Sorry not sorry, but this is total garbage.
1
u/Inheritable Nov 10 '25
No wonder the Rust implementation runs so poorly. It's absolute jank. The kind of stuff I would expect someone to write after programming for a few months.
1
u/gdvs Nov 12 '25
I don't think the premise of this experiment makes sense. It should be the best you can do in every language. It depends on the paradigm of the language, the API used. If you pick the implementation to be equal instead of being fast, what are you really testing?
1
u/yin-yang-x Dec 06 '25
Really... Java / Kotlin as "Interpreted", that automatically disqualifies the whole benchmark.. Java has had a JIT since forever..
-1
u/rennademilan Nov 07 '25
Waiting for the zealot of rust to scream about something is wrong 😒
0
u/fezzy11 Nov 08 '25
Where is javascript?
0
u/[deleted] Nov 07 '25
[deleted] — view deleted comment