3 ms·
For this particular benchmark Rust is beating C and LuaJIT by an unbelievable margin. I emitted IR for the Rust code[1] and it contains 4613732, the result of f
by bilalhusain 12y ago
For this particular benchmark Rust is beating C and LuaJIT by an unbelievable margin. I emitted IR for the Rust code[1] and it contains 4613732, the result of function f.
[1] https://github.com/japaric/eulermark.rs/blob/master/problems/002/002.rs https://github.com/japaric/eulermark.rs/blob/master/problems...
[2] compilation flags used: rustc -O --emit ir 002.rs
- Jweb_Guru 12y agoThis is one of the reasons microbenchmarks are really not particularly useful, especially when comparing two different languages. You have to intentionally cripple the optimizer in order to even get some of them to run the "actual" algorithm. And you have to restrict the algorithm used even if it might be impossible to implement the fastest algorithm as efficiently in one or more of the languages. You might argue that the point isn't to test the particular code, but the properties of the language and its optimizer. That's fair, but what about languages like Go that don't try to do constant folding like this in the name of fast compilation, or interpreted languages that don't perform JIT compilation? They are going to look unrealistically good on benchmarks like this compared to how similar routines would perform in an actual program.