4 ms·
> It turns out that if you have language semantics that make optimizations hard, making a fast optimizing compiler is hard. Who woulda thunk? Is this in the ar
by almostgotcaught 1y ago
> It turns out that if you have language semantics that make optimizations hard, making a fast optimizing compiler is hard. Who woulda thunk?
Is this in the article? I don't see Python's semantics mentioned anywhere as a symptom (but I only skimmed).
> shows how poorly a lot of people understand what goes into making a language fast.
...I'm sorry but are you sure you're not one of these people? Some facts:
1. JS is just as dynamic and spaghetti as Python and I hope we're all aware that it has some of the best jits out there;
2. Conversely, C++ has many "optimizing compiler[s]" and they're not all magically great by virtue of compiling a statically typed, rigid language like C++.
- o11c 1y agoJS is absolutely not as dynamic as Python. It supports `const`ness, and uses it by default for classes and functions.
- dontlaugh 1y agoMore importantly, there's nothing like locals[] or __getattribute__.
- pjmlp 1y agoSmalltalk has them, and its JIT research eventually became Hotspot. Anything can change at any time in Smalltalk.
- dontlaugh 1y agoStrongtalk limited dynamic features. But you’re not wrong in general. Even for Python there’s PyPy, with a JIT ~3x faster than CPython.
- pjmlp 1y agoStrongtalk was the transition step between Smalltalk JITs and what became Sun's Hotspot, but that wasn't the main point I was making. Also to note that even in that regard, Java happens to be more dynamic that people think, while the syntax is C++ like, the platform semantics are more akin to Smalltalk/Objective-C, hence why a JIT with such a background was a great addition.
- hyperpape 1y agoThere's a pretty big gap between "its JIT research eventually became Hotspot" and "Smalltalk can be made to perform on a par with Hotspot."
- pjmlp 1y agoHN comments usually aren't big enough for a CS lecture regarding evolution of dynamic compilation, aka JIT. There is enough stuff to fill at least one semester.
- igouy 1y agoAnd then we find out that Smalltalk implementations might choose to optimize instead of allowing anything to change at any time. ifFalse: alternativeBlock "Answer the value of alternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^alternativeBlock value
- pjmlp 1y agoOne tree doesn't make a forest, from whatever implementation that was taken out of, and naturally there are always magician tricks that PyPy also uses.
- igouy 1y ago*iirc* pretty much all of the Smalltalks (that was CUIS). ~ "Creating blocks in Smalltalk has always been a potential source of performance problems. … In Resilient, we have restricted blocks to be last in-first-out (LIFO)…" https://blog.bracha.org/resilient-paper.pdf https://blog.bracha.org/resilient-paper.pdf ~ "Digitalk’s Team/V unobtrusively introduced a non-reflective syntax…" https://wirfs-brock.com/allen/posts/914 https://wirfs-brock.com/allen/posts/914
- almostgotcaught 1y agoyes there is: https://wiki.python.org/moin/UsingSlots https://wiki.python.org/moin/UsingSlots people really don't know enough about this to be talking about it with such confidence...
- dontlaugh 1y agoI was pointing examples of the opposite, that JavaScript is less dynamic than Python. There's lots of Python code out there that relies on not using slots. If you're making a JIT, you can't assume that all code is using slots.