| ▲ | jmalicki 3 hours ago | |||||||||||||||||||||||||
Every time I've rewritten something from Python into Java, Scala, or Rust it has gotten around ~30x faster. Plus, now I can multithread too for even more speedups. Python is absurdly slow - every method call is a string dict lookup (slots are way underused), everything is all dicts all the time, the bytecode doesn't specialize at all to observed types, it is a uniquely horrible slow language. I love it, but python is almost uniquely a slow language. Algorithms matter, but if you have good algorithms, or you're already linear time and just have a ton of data, rewriting something from a single-threaded Python program to a multithreaded rust program I've seen 500x speedups, where the algorithms were not improved at all. It's the difference between a program running overnight vs. in 30 seconds. And if there are problems, the iteration speed from that is huge. | ||||||||||||||||||||||||||
| ▲ | eru 2 hours ago | parent | next [-] | |||||||||||||||||||||||||
> [...], it is a uniquely horrible slow language. To be fair, Python as implement today is horribly slow. You could leave the language the same but apply all the tricks and heroic efforts they used to make JavaScript fast. The language would be the same, but the implementations would be faster. Of course, in practice the available implementations are very much part of the language and its ecosystems; especially for a language like Python which is so defined by its dominant implementation of CPython. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | byroot 2 hours ago | parent | prev [-] | |||||||||||||||||||||||||
> every method call is a string dict lookup Doesn't the Python VM have inline caches? [0] | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||