4 ms·
I've gotten 400x speedups going from python to c++.
by GFK_of_xmaspast 10y ago
I've gotten 400x speedups going from python to c++.
- dagw 10y agoI've gotten 200x speedup going (badly written) Javascript to (better written) pure python, despite python being a nominally slower language according micro-benchmarks. Comparing run time without knowing anything about the code doesn't say much.
- MikeHolman 10y agoWere you using a js runtime without a JIT? Were your python algorithms better? Otherwise a 200x speedup sounds completely unbelievable. That would basically indicate a bug in the js runtime causing degenerate performance under your scenario.
- lqdc13 10y agoThat's very believable. Example: popping from the beginning of a list in Python is O(N). Popping from the end is O(1). Initial poorly written code can have a lot of such obvious optimizations.
- sgt101 10y agoIt's a common programming thing - you write your code, it compiles, it runs, it runs properly on your test case, you try it on your full data, it's too slow. You run your profiler and you spot some problems, you solve them, it's still too slow, repeat until fast enough, declare victory.
- dagw 10y agoI replaced some inefficient code with some better O(n log n) code. Make n large and you'll get to 200x. Which was kind of my point, without making sure you've held every else the same, saying I rewrote X in Y and got Z improvement doesn't always say that much.
- cowsandmilk 10y agoI've gotten 400(+)x speedups by going from python to python. Original program was 50min in python, 1 min pypy After figuring out some inefficiencies that were O(Nsquared), it was 3 seconds in python This was timing for a case where N was much larger than my normal cases, where run time had been a couple seconds with the original version and optimization didn't really matter.