4 ms·
Have you seen these benchmarks? https://github.com/logicchains/LPATHBench/blob/master/writeup.md https://github.com/logicchains/LPATHBench/blob/master/writeu...
by dom96 12y ago
Have you seen these benchmarks? https://github.com/logicchains/LPATHBench/blob/master/writeup.md https://github.com/logicchains/LPATHBench/blob/master/writeu...
- deleted 12y ago[deleted]
- simias 12y agoI have not, I mostly glanced at http://benchmarksgame.alioth.debian.org/ http://benchmarksgame.alioth.debian.org/ where Rust generally matches C performance whithin a few %. But Nim is not part of this benchmark apparently. I haven't looked at your link in details but the fact that one C++ implementation manages to outperform all the others (including other C and C++ implementations and of course Rust and Nim) by more than one order of magnitude leaves me perplex. It means there must be a huge room for improvement in a lot of those tests. Also the timing code is implemented in the tests themselves using each language's primitives which seems a bit risky to me when comparing language performances. Also the unsafe rust version has exactly the same performance as the safe one which is weird. After looking at the unsafe version it appears that all the unsafe blocks are just here to remove the bound checks on the vector indexing and that's it. That seems like a weird choice for optimization, I'd have tried to make the recursive function iterative first, for instance. At least it goes to show that that particular check is not too expensive and it's better to stick to safe code when possible.
- perturbation 12y ago>...one C++ implementation manages to outperform all the others ... by more than one order of magnitude As does the cached Javascript version. All of the implementations in the path benchmarking by fiat use a naiive algorithm (recompute the cost for each recursive traversal). The C++ and Javascript cached versions are supposed to show that algorithm choice is much more important than language choice (and do some memoization of the cost calculation). https://github.com/logicchains/LPATHBench/blob/master/jscache.js https://github.com/logicchains/LPATHBench/blob/master/jscach...
- idlewan 12y ago> he fact that one C++ implementation manages to outperform all the others (including other C and C++ implementations and of course Rust and Nim) by more than one order of magnitude leaves me perplex. This uses a "pruning" algorithm and is a different algorithm than all the other implementations use. It shouldn't be used to compare the different languages, as it's just not doing the same work.