4 ms·
*for very specific benchmarks, not "on average"
by throwaway314155 1y ago
*for very specific benchmarks, not "on average"
- morshu9001 1y agoquick n dirty Python code will run faster than quick n dirty C++ code
- username223 1y agoTrue, Python could be better or worse than two orders of magnitude slower for your particular use case, but it's 70x slower for recursion and addition that it clearly hasn't special-cased. That's good to know.
- igouy 1y agoWell, if that's good to know -- https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/comparable.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- repsilat 1y agoFor compute-heavy code "100x slower than C++" is a good rule of thumb in my experience in python 3.10.
- throwaway314155 1y agoMaybe when you are reinventing the wheel instead of using e.g. numpy, Jax, PyTorch. Python is an ecosystem some of which is tooling built in C/C++. There’s no reason to ignore those libraries just because C devs like to roll their own everything.
- repsilat 1y agoThere's an Amdahl-like effect, where "100x slower" means that anything nontrivial in pure python ends up being fat in your flamegraphs, even if your "heavy lifting" core algorithmic stuff uses some nice fast libraries.