4 ms·
My Java timing is very close to Rust. I have a feeling PyPy is eliminating the string conversion as dead code. When I alter my Java toy code to not prevent elim
by eggsnbacon1 6y ago
My Java timing is very close to Rust. I have a feeling PyPy is eliminating the string conversion as dead code. When I alter my Java toy code to not prevent elimination of the toString() call it runs close to speed of PyPy.
- apta 6y agoI found Java's to be quicker than Rust: Java: time java Test 117777800 0.60 real 0.52 user 0.12 sys Rust: time ./test 117777800 1.94 real 1.89 user 0.00 sys
- steveklabnik 6y agoWhat flags did you use with Rust?
- apta 6y agoBoth `-O` and `-C opt-level=3`. I'm guessing this is one of those high throughput scenarios where having a GC is quicker because it's able to defer deallocation until the end of the program.
- steveklabnik 6y ago-O is opt level 2, incidentally. Yeah, I think you’re right. Very interesting!
- bscphil 6y ago> I have a feeling PyPy is eliminating the string conversion as dead code. If I'm not mistaken, the specific variation of the benchmark shown upthread could not be eliminating the string conversion, as it's adding the length of the resulting string to a variable which is later printed. > len(str(i))