5 ms·
It's perhaps worth pointing out that programming languages are not themselves fast or slow; it is the programming language implementations that are fast or slow
by DonaldPShimoda 6y ago
It's perhaps worth pointing out that programming languages are not themselves fast or slow; it is the programming language implementations that are fast or slow. (This is a particularly sore point in the programming languages research community.)
- ngcc_hk 6y agoI thought the pure python has issue as it assume sync on one global thread. Well if you mutatable global var ... or it is is not
- TylerE 6y agoNothing in the spec requires the GIL. Not having it would slow the vast majority of workload. Jython does not have a GIL. https://wiki.python.org/moin/GlobalInterpreterLock https://wiki.python.org/moin/GlobalInterpreterLock
- TylerE 6y agoThere are certainly languages that it is essentially impossible to implement to run fast. Like, one can certainly write a slow C... but writing a fast Python (real Python, I mean, with full reflection, run-time introspection, etc..) would be...near impossible. Yes, I know there are projects that make large subsets of Python run fast, but it's that last 5% that kills you.
- nerdponx 6y agoFWIW PyPy is signfificantly faster than CPython in a lot of tasks.
- marcosdumay 6y agoPyPy doesn't support a lot of CPython's reflection and introspection. to see the problem with Python, take this loop as an example: x = 0 for i in range(0,1000): x = x + i There is no way, looking only at this part of the code to know if the `+` operator does the same operation every time it is executed.
- nerdponx 6y agoWouldn't that require some code to redefine `int.__add__` or `int.__radd__` between iterations of the loop? Which I would file under "bizarre shit that shouldn't normally happen." Before the loop starts, you'd have to override `int.__add__` to modify itself every time it's called, or something crazy. If we're talking about custom classes and not ints, maybe it's a bigger problem. But if PyPy doesn't allow the required introspection to make this work, how does it run anything at all?
- hawski 6y agoIt's usually not worth pointing out. Most languages have a single implementation and definition of the language and especially its ecosystem is married to it. Some have more, but usually an ecosystem is popular for only one of them, because they are not entirely compatible. Nowadays by a language people usually mean the whole package.