3 ms·
Results: c++ 1.129 seconds python 41.674 seconds ruby 8.730 seconds R 13.602 seconds js (node) 0.481 seconds What surprises me: Python slower than R and r
by nomilk 3y ago
Results:
c++ 1.129 seconds
python 41.674 seconds
ruby 8.730 seconds
R 13.602 seconds
js (node) 0.481 seconds
What surprises me: Python slower than R and ruby. js faster than c++.
- Someone 3y agoThey compile the “C++” (which isn’t C++ but some implementation of C++, likely Apple clang 15.0.0) without any optimizations. g++ -std=c++14 1bn.cpp time ./a.out 1000000000 When I run this on a Macbook Air M2 without optimizations versus with “-O3”, wall clock running time decreases from about 700ms to 6 ms (sometimes less than that) (Also, with “-O3”, changing the loop limit doesn’t affect running time, so clang optimizes away that loop)
- Qem 3y ago> What surprises me: Python slower than R and ruby. js faster than c++. Nowadays Ruby includes a JIT compiler.