6 ms·
Rust on Computer Language Benchmarks Game
- Rickasaurus 13y agoWhat's the deal with pidigits? Losing out bad to PHP here even.
- iopq 13y agobecause it's not using GMP
- saidajigumi 13y agoSo if I understand correctly, the pidigits test in this case this isn't a self-contained, fully ported microbenchmark, but rather a test of some random Rust code vs. an optimized library[1]? If that's true, then what's the point of including pidigits if the entire algorithm isn't going to be ported into all target languages? [1] GMP, The GNU Multiple Precision Arithemtic Library: https://gmplib.org/ https://gmplib.org/
- iopq 13y agoIt's more of a "testing the platform" rather than the language. You can write a Rust program that runs at exactly the same speed as a C program (the difference here would be clang backend vs. gcc moreso than the choice of language).
- wmf 13y agoThat becomes more of a pass/fail test (either you're using the fastest known library or you aren't) which isn't very interesting as a benchmark.
- pcwalton 13y agoAs I understand it, the rule is "if your language comes with a bignum implementation, you must use it, otherwise you may use GMP". I've been seriously tempted to suggest removing our bignum implementation for this reason (though I won't).
- qbproger 13y agoPython uses GMP while having a bignum implementation. I believe any language is allowed to use it. Python: http://benchmarksgame.alioth.debian.org/u64/program.php?test=pidigits&lang=python3&id=2 http://benchmarksgame.alioth.debian.org/u64/program.php?test... Ruby: http://benchmarksgame.alioth.debian.org/u64/benchmark.php?test=pidigits&lang=yarv&id=2&data=u64 http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...
- igouy 13y agoThere is no such rule. When someone contributes a Rust pi-digits program that uses GMP it will be shown (as long as it uses the same algorithm). We get to see both programs that use GMP and programs that don't.
- legulere 13y agoBignum math isn't optimized for performance yet. See this discussion: http://www.reddit.com/r/rust/comments/1xcq1q/c_gcc_vs_rust_wtf/ http://www.reddit.com/r/rust/comments/1xcq1q/c_gcc_vs_rust_w... There are also already some patches making rust a lot less worse: https://github.com/mozilla/rust/pull/12209 https://github.com/mozilla/rust/pull/12209
- pcwalton 13y agoA fix is in the queue. It was a tiny thing. Currently there is an Android buildbot issue that is preventing anything from landing, but hopefully that will be resolved today.
- Scaevolus 13y agoWhy don't any of the Rust benchmarks have their source code on the site?
- steveklabnik 13y agoUnsure, but we're pretty sure they take them from here: https://github.com/mozilla/rust/tree/master/src/test/bench https://github.com/mozilla/rust/tree/master/src/test/bench All the shootout* ones.
- igouy 13y agohttp://www.reddit.com/r/rust/comments/1xcq1q/c_gcc_vs_rust_wtf/cfcevuu http://www.reddit.com/r/rust/comments/1xcq1q/c_gcc_vs_rust_w...
- tomp 13y agoIt's ridiculous and sad that they would include Rust, after banning LuaJIT a few years ago, citing "too much maintenance effort" (even though LuaJIT benchmarks were significantly more complete that Rust's)
- masklinn 13y agoThe shootout has been utterly ridiculous for quite a long time. I remember when the maintainer(s?) threw a fit when pypy devs tried getting python versions not relying on cpython tricks (which didn't bench well for pypy) even though multiple programs per language had not been an issue before. Then they ended up banning multiple implementations, but their implementation pick is completely arbitrary.
- brandonbloom 13y agoSeems like an opportunity for an enterprising hacker to create a more open and collaborative "benchmarking social network" of sorts.
- GregBuchholz 13y agoYou might think so, but keep in mind that it is a thankless volunteer job that's been on-going for something like 10 years. I'm pretty sure that Isaac would encourage your efforts to make that site. http://benchmarksgame.alioth.debian.org/play.php#faqs http://benchmarksgame.alioth.debian.org/play.php#faqs
- brandonbloom 13y agoSurely in today's world with elastic compute and robust virtual containers, it should be possible to replace thankless volunteer work with automated, self-service processes. I'm not saying it would be easy (or economically viable), but it's certainly possible. Somebody should try it.
- awj 13y ago
- hangonhn 13y agoAnyone else a bit shocked by how well Javascript on V8 performs? I might need to rethink my assumptions but it actually runs faster than Python 3 according to this.
- wmf 13y agoYes, a very advanced JIT is faster than an interpreter.
- frik 13y agoPython 3 is slow, one should compare PyPy, HHVM-PHP, LuaJIT, etc. A company did that back in Dezember: http://www.techempower.com/benchmarks/#section=data-r8&hw=i7&test=update http://www.techempower.com/benchmarks/#section=data-r8&hw=i7... (found it on HN) Revel uses LuaJIT (afaik), HHVM is HipHop PHP (Facebook) and you can find PyPy there too.
- RyanZAG 13y agoThat benchmark isn't benchmarking what you think it is. "This test exercises database writes. Each request is processed by fetching multiple rows from a simple database table, converting the rows to in-memory objects, modifying one attribute of each object in memory, updating each associated row in the database individually, and then serializing the list of objects as a JSON response." You're actually just benchmarking the mysql driver for each of those languages, not the actual JIT capabilities.
- frik 13y agoThe website design is a bit confusing, you probably missed the other tabs: "JSON serialization", "Single query", "Multiple queries", "Fortunes", "Data updates", "Plaintext". It's a micro benchmark but at least it covers a lot of languages and frameworks. (I saw that benchmark site on HN some months ago)
- xmonkee 13y agoHow is Go slower than Java? Actually Go is pretty slow compared to many languages I would've expected it to be faster than.
- Buttons840 13y agoWhy did you expect Go to be faster than Java? One thing that surprised me about that benchmark is how many languages fall into the "2 to 3 times slower than C" category. They all have various merits, but seemingly equal performance. I've also noticed each of the languages I'm familiar with have gone through a hopeful stage of "were as fast as C" only to fall short.
- igouy 13y agoRemember, it's -- how many [programs] fall into the "2 to 3 times slower than [the] C [programs]" category.
- RyanZAG 13y agoThere's this strange idea still floating around that Java is somehow slow. Compared to hand crafted micro benchmark C code, Java is slower. But then so is everything else. The simple facts are that the JVM is the most advanced and efficient VM available today, and the JVM is specifically targeted to increase the speed of Java. It's not much of a stretch to expect good speed out of that regardless of strange preconceptions you may have had. The Go VM has a long long way to go be even remotely comparable to the JVM in garbage collection etc.
- pekk 13y agoHow much slower than C do you have to be in order to be called slow? Apparently, the cutoff is defined like this: as slow as Java is not slow, but any slower than Java is slow.
- RyanZAG 13y agoGo is anything but slow, it's just not as fast as Java. I was just addressing the idea that Java is somehow slow which seems to float around occasionally. Java is arguable the fastest language that isn't directly C-based and anybody thinking of it as slow is simply misinformed.
- riquito 13y agoIsn't a bit soon to benchmark Rust?
- steveklabnik 13y agoNope! http://huonw.github.io/isrustfastyet/ http://huonw.github.io/isrustfastyet/ It's important to track this over time to make sure regressions don't get in.
- brson 13y agoMaybe not. Rust is starting to mature and the code generation is already quite good (though there are still many opportunities for improvement). Hopefully this exposure will inspire people to improve these benchmarks. With a little effort Rust should be very competitive on them.