News for hackers. Stuff that matters.
Re:How Many Lines of C It Takes to Execute a and B in Python? by pjmlp on Tuesday December 12, 2023 @02:26AM (#38610658)
Smalltalk, SELF and Common Lisp are full of dynamic magic, you can in a single function call change the representation of all instances of a given object during program execution, at any given time break into the debugger and change whatever you feel like and resume execution, dynamically load code from the network with side effects on the running program, and many other crazy things.

Yet, not only are they in the genesis of JIT compiler research, their JITs are quite good, and their results went directly into JavaScript JITs research.

Re:How Many Lines of C It Takes to Execute a and B in Python? by lifthrasiir on Tuesday December 12, 2023 @02:34AM (#38610719)
Is there any direct comparison though? Because it can be alternatively argued that these dynamic languages needed new JIT techniques for performance, but they especially work well for more constrained languages like JS. I don't think Smalltalk was ever a good fit for number crunching, for example.
Re:How Many Lines of C It Takes to Execute a and B in Python? by pjmlp on Tuesday December 12, 2023 @06:58AM (#38611085)
Better than CPython, regardless of how you put it.
Re:How Many Lines of C It Takes to Execute a and B in Python? by igouy on Tuesday December 12, 2023 @01:11PM (#38616000)
Re:How Many Lines of C It Takes to Execute a and B in Python? by lifthrasiir on Tuesday December 12, 2023 @11:10PM (#38622543)
Exactly. Comparing with CPython is too easy and arguably unfair, Smalltalk should be compared with JS instead and I think it has no chance in that setting.
Re:How Many Lines of C It Takes to Execute a and B in Python? by pjmlp on Wednesday December 13, 2023 @02:41AM (#38623870)
Why should it be compared?

We are not comparing Smalltalk JITs to Javascript JITs.

The whole point of this conversation is CPython refusing to add one, and the lame excuses regarding its dynamic capabilities, when more dynamic languages have had a JIT for decades.

Re:How Many Lines of C It Takes to Execute a and B in Python? by lifthrasiir on Wednesday December 13, 2023 @05:02AM (#38625068)
First, because CPython had more concerns than what Smalltalk implementations have, so such comparison would be unfair to Python. (See my topmost comment for example.)

Second, my question was about the possibility that Smalltalk and others were unbearably slow without JIT, so JIT was not a matter of choice for them. I'm not aware of Smalltalk implementations that don't have JIT, so it would be easier to compare Smalltalk with another well-optimized JIT implementation instead---in this case JS.

Re:How Many Lines of C It Takes to Execute a and B in Python? by whizzter on Wednesday December 13, 2023 @05:48PM (#38635290)
Not much in the Python language is categorically worse than features within JS when it comes to JIT creation.

My thesis work was on AOT JS compilation, in it I refer to a bunch of experimental Python runtimes, Self,etc and the main issues in all these papers were basically the of same kind.

Heck, even PyPy exists and iirc when it comes to the core language is almost entirely compatible (except for code that relies on ref-counting semantics but that code should apparently big fixed anyhow).

https://www.pypy.org/compat.html

The real summary is: CPython is a turd in many ways, the old C api holds it back and the community hasn't put the effort into using cross-implementation compatible C-bindings instead making PyPy or others a second class citizen.

Re:How Many Lines of C It Takes to Execute a and B in Python? by pjmlp on Wednesday December 13, 2023 @02:39AM (#38623846)
CPython is the one being compared here, and besides Pharo, better use an industrial strength one, like Cincom Smalltalk.
Re:How Many Lines of C It Takes to Execute a and B in Python? by igouy on Wednesday December 13, 2023 @02:53PM (#38633306)
Cincom Smalltalk is the one being compared.
Re:How Many Lines of C It Takes to Execute a and B in Python? by igouy on Tuesday December 12, 2023 @01:08PM (#38615949)
So if one was "Prototyping a Real-Time Embedded System in Smalltalk" one might 'improve frequently invoked methods by recoding, possibly as “primitive” functions in a lower level language such as C or assembler'.

https://dl.acm.org/doi/pdf/10.1145/74878.74904

Re:How Many Lines of C It Takes to Execute a and B in Python? by pjmlp on Wednesday December 13, 2023 @02:42AM (#38623883)
CPython is up to date with one specific Smalltalk implementation in 1987, when an ESP32 has better hardware resources than those systems, what a great achievement!
Re:How Many Lines of C It Takes to Execute a and B in Python? by igouy on Wednesday December 13, 2023 @02:51PM (#38633285)
One way Smalltalk was made a better fit for number crunching: primitives.