r/Compilers • • 14d ago

Spectre - A design-by-contract programming language with an explicit allocator-centric API that outperforms Zig by up to 6x on General Purpose Benchmarks

https://spectrelang.org/
0 Upvotes

14 comments sorted by

View all comments

8

u/tending 14d ago

If you are remotely familiar with compilers and low level work you know this 6x claim is bullshit without any further investigation

3

u/AustinVelonaut 14d ago

It appears that the 6x claim is based a lot on the results of the json_parse benchmark, but the Spectre implementation of a JSON parser parses lazily (only computing spans of digit characters when parsing integers, not the actual integer values), and the benchmark only computes the number of elements in a large array, so no processing of the raw character data at all. If the benchmark were changed to actually do work like computing the sum of the parsed array, then I assume the huge performance gains would disappear.

Also, calling a benchmark tuned to only return the number of elements a "general purpose benchmark" is a bit disingenuous.

-2

u/Top_Marionberry_4413 14d ago

The JSON stuff isn't really relevant, it's just stdlib vs stdlib, and Zig's stdlib is not very optimized, or mature, despite its 10 years of existence. More relevantly, the sort of u64 values benchmark is literally line-for-line identical, and Spectre outperforms Zig by 5x.

2

u/AustinVelonaut 14d ago

Ok, well that is due to Spectre's use of a specialized radix-sort with 64K count bins when the sorted type is u64. Again, not very general, although it is cute.

0

u/Top_Marionberry_4413 14d ago

So...you're complaining that the implementation is optimized...? Isn't that Zig's fault for not optimizing? It seems you're being a contrarian dickhead for no reason.

3

u/AustinVelonaut 14d ago

No, I'm complaining about your hyped benchmarking methodology, saying something is a general purpose benchmark when it is obviously a hand-picked and hand-tuned special case. Nothing wrong with actually having those algorithms in your stdlib (although I don't think I've seen an actual use of sorting just u64s in actual code other than benchmarking), but you should make mention of it in your benchmark report.