top | item 45837766

(no title)

Figs | 3 months ago

Depending on the nature of your code, just throwing pypy at it instead of cpython can be a huge win. This very much depends on what you're doing though. For example, I have a graphics editor I wrote that is unbearably slow with cpython; with pypy and no other changes it's usable.

If what you're trying to do involves tasks that can be done in parallel, the multithreading (if I/O bound) or multiprocessing (if compute bound) libraries can be very useful.

If what you're doing isn't conducive to either, you probably need to rewrite at least the critical parts in something else.

discuss

order

thomasmg|3 months ago

Pypy is great for performance. I'm writing my own programming language (that transpiles to C) and for this purpose converted a few benchmarks to some popular languages (C, Java, Rust, Swift, Python, Go, Nim, Zig, V). Most languages have similar performance, except for Python, which is about 50 times slower [1]. But with PyPy, performance is much better. I don't know the limitations of PyPy because these algorithms are very simple.

But even thougt Python is very slow, it is still very popular. So the language itself must be very good in my view, otherwise fewer people would use it.

[1] https://github.com/thomasmueller/bau-lang/blob/main/doc/perf...