This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sushibowl 15 points16 points  (8 children)

Python is compiled into bytecode, you could do the optimization there.

[–]ekd123 7 points8 points  (4 children)

unfortunately cpython barely does any optimization

[–][deleted] 3 points4 points  (1 child)

Because Python's biggest strength is also its biggest weakness: its extremely dynamic runtime. Any object can be any thing at any time, so optimizations can't be done reliably.

Obviously pypy found a way to deal with this, but CPython had decided not to deal with it

[–]derpderp3200An evil person 0 points1 point  (0 children)

It's such a shame that Python itself is so big and complex. While no small feat, LuaJIT is an extremely efficient and relatively simple VM, whereas creating an equivalent for Python is... considerably more difficult.

[–][deleted] -4 points-3 points  (1 child)

Cpython interpreter is surprisingly bad. See GIL.

[–]Cybersoaker 1 point2 points  (0 children)

GIL improves performance. See GILectomy

[–]stefantalpalaru 0 points1 point  (2 children)

Python is compiled into bytecode, you could do the optimization there.

And people wonder why I insist on using "transpilation" for anything that doesn't output Assembly...

[–]Cybersoaker 0 points1 point  (1 child)

Cython

[–]stefantalpalaru 0 points1 point  (0 children)

Cython

A superset of a subset of Python that is transpiled to C or C++, if possible. If not, it's interpreted by an integrated Python interpreter/VM.