Comment

Comment by noelwelsh

> It's instructive to look at javascript and python. Javascript engines are much faster than python engines because Javascript doesn't do threads.

I don't think this is the primary difference. While JS's semantics are bad for performance, Python's are insance. Two examples:

- In Python you can change the meaning of operators, so that 1 + 2 could mean something very different from integer addition. This can happen at any point within a program, so you must always guard against the possibility that basic arithmetic---some of the fastest operations on a CPU---has changed meaning. This slows things down considerably. JS is fairly dynamic but AFAIK it's impossible to change this.

- Python allows inspecting the stack (https://docs.python.org/3/library/inspect.html#the-interpret...) so at any point in your program you have to be prepared to reflect the stack as Python objects. Bye-bye performance.

parent noelwelsh 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton