r/programming • u/madonuko • 6d ago
Debunking "Faster than Rust": Malicious Benchmarks in Tov
https://blog.fyralabs.com/debunking-faster-than-rust-malicious-benchmarks-in-tov/I have debunked (some of the) benchmarks of this new and suspicious "Tov" programming language.
Slight background: My friend (who is pretty interested in new stuff generally) found this thing and sent its main site to me saying things like "looks pretty cool", but my intuition told me this sounds like "a scam", esp. when it claimed it performs faster than C and Rust.
I personally think apart from changing the code, they probably tried to set up some specific environments that make their programs run faster than C / Rust, or maybe they just made up the numbers. Who knows.
16
u/the3gs 5d ago
I wouldn't think to use ahash over std::collections::HashMap unless I very specifically was dealing with a hashmap related bottleneck, and even then I would have to research to find ahash, so I think it is unfair to say "they deliberately used the standard library instead of a library to slow it down".
9
u/moefh 5d ago
You wouldn't think you're hitting a hashmap-related bottleneck in a benchmark named "map_insert"?
→ More replies (2)
66
u/Ok_Mycologist_6604 6d ago
basically with AI we got rebranded crypto bros into the industry and I am sick and tired of it, there is no solution for it. they will take ur job with the slop until a plane crashes and people maybe re-evaluate.
3
8
u/stumpychubbins 6d ago
From their pitch, I would not be surprised if what they’re actually benchmarking between languages is the code produced by default by an AI coding agent if you ask it to solve the stated problem in the given language. An AI will not use the ahash library, so they don’t use the ahash library in their benchmarks, and for them that constitutes an accurate benchmark in their eyes.
8
u/YaBoyMax 5d ago
I see where you're coming from, but I think that's overly charitable. I fed the benchmark description verbatim to free ChatGPT with the prompt:
Implement the following program in Rust. Optimize for maximum performance.
It immediately used
ahashwithout further prompting. I'm not discounting that usingHashMapcould be an honest mistake for that particular case, but I don't think they designed the benchmarks explicitly with LLMs in mind for other languages. Even if they had, that should have been clearly disclosed.2
u/stumpychubbins 5d ago
Well, that’s certainly damning. I wasn’t really giving them credit, I still think it’s a terrible way to handle benchmarks, I just thought there was a possibility of it not being malicious. It sounds like even with that bad methodology they still should’ve ended up with better results than they did, though
7
2
u/bwainfweeze 5d ago
If I’m recalling the anecdote correctly, Brian Cantrell tried to solve a problem in Rust and found that it was much faster than C++ in a very surprising manner.
When he dug into the code he found that the Rust solution was using a B-tree under the hood. He said that made sense because it was easier to write a correct implementation in Rust and C++ would use something more conservative for correctness.
Moral of the story is, when a new language shows up, the test is not if you can do a thing that language does in the old language. It’s whether you will do that thing. The same way the first person I recall predicting the future success of smart phones over laptops. You can take a laptop with you, but you will take a pocket computer with you.
So what I’m looking for in a new language is if it supports better semantics and/or data structures that nobody attempts in my status quo language. Such benchmarks are “unfair” but still completely apropos. It is in fact the entire point of writing something new instead of using what exists.
13
u/cdb_11 5d ago edited 5d ago
When he dug into the code he found that the Rust solution was using a B-tree under the hood. He said that made sense because it was easier to write a correct implementation in Rust and C++ would use something more conservative for correctness.
The ordered set in Rust's standard library is just implemented as a B-tree, using
unsafe. C++ uses red-black trees. Not because they are particularly easier to implement, but because the standard requires iterator stability. And this rules out using a B-tree. Standardizing these mostly useless guarantees was just a historic mistake, the same way STL's hash map was. Keep in mind that this is just what the standard library does. People do use B-trees in C++.My alternative moral of the story is that the interface can lock you out of optimizations, and that once the interface gets adopted it can be hard or impossible to change it.
→ More replies (1)
2
u/HatProud9045 6d ago
Worth noting they probably disabled CPU throttling too. Classic benchmark trick.
9
u/carsncode 5d ago
That's not a trick - unless throttling is the thing you're measuring, leaving it on for a benchmark only makes results less informative
1
u/Gio_Cri 2d ago
at a first glance their benchmarks actually seem comparable for small toy projects with naive implementations. would be interesting to see a comparison on what it's like on larger projects, personally i expect the performance andvantage and code ease to be negated quickly with project size
1
u/bwainfweeze 5d ago
It is very hard to get clean benchmarks and confirmation bias is everywhere. If the first run supports your claim people tend to declare victory and move on.
In some benchmarking system it can be whoever goes first who runs faster. Or sometimes whoever goes second, particularly in JITs. It’s not an always thing but when you do something repeatedly and rely on it, it doesn’t take that many false positives to look like a numpty.
181
u/a__nice__tnetennba 6d ago
How is something that is C faster than C? That's a bizarre claim regardless of how it actually compares to Rust directly.