Earlier quoted context omitted.
Better than CPython, regardless of how you put it. EDIT: Also to note, those languages powered whole graphical single workstations, with microcoded CPUs + JIT. "Efficient implementation of the smalltalk-80 system" https://dl.acm.org/doi/10.1145/800017.800542 https://computerhistory.org/blog/introducing-the-smalltalk-z... "Self-Confidence: How SELF Became a High-Performance Language" https://www.cs.cornell.edu/courses…
vs CPython https://benchmarksgame-team.pages.debian.net/benchmarksgame/... vs Node https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
How many lines of C it takes to execute a + b in Python
201–210 of 224 posts
Re: How many lines of C it takes to execute a + b in Python
#202Earlier quoted context omitted.
vs CPython https://benchmarksgame-team.pages.debian.net/benchmarksgame/... vs Node https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
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.
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 + b in Python
#203Earlier quoted context omitted.
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.
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 + b in Python
#204Earlier quoted context omitted.
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.
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.
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 + b in Python
#205Earlier quoted context omitted.
If you want to be return absolutely any value from an iterator, an exception is indeed a reasonable choice though. Python generators came in much later, unlike JS for example.
If that is indeed a requirement, you let your iterator have an .at_end() test instead of trying to shoehorn it into the return value. Or have something like C++'s std::optional or Rust's Option. Or a special EndOfIteration object that you cannot return from an iterator (is that really so bad?). Iteration is extremely common, and should thus be based on as simple primitives as possible if you want things to go fast.
Re: How many lines of C it takes to execute a + b in Python
#206A while back someone posted their patch to cpython where they replaced the hash function with a fast one and claimed this dramatically sped up the whole Python runtime. They claimed that the hash function was used constantly —e.g. 11 times in print("hello world")—because it's used to look up object properties. Apparently the default implementation is not optimized for performance but for security, just in case the so…
This may be a somewhat uninformed opinion, but I think CPython is just straight up not particularly good software. There are a million and one optimizations that other major scripting runtimes (V8, LuaJIT, PyPy, Ruby YJit etc.) have had for years that CPython is lacking. This is by design though. CPython has never been focused on performance, that's why it's not even JIT. It optimizes for simplicity and easy interope…
Re: How many lines of C it takes to execute a + b in Python
#207Earlier quoted context omitted.
I agree with that estimate, I think it was really the idea of Python to be less than "good" by design. I mean one doesn't need more than: >>> exit Use exit() or Ctrl-D (i.e. EOF) to exit to see. They have that special handling, but they still don't want to let you out, because... IMO, they just want to be annoying. When a solution could be something like: Note: exit() is needed in scripts. In this prompt Ctrl-D (i.e.…
There has been discussion of this change a few times, e.g. https://bugs.python.org/issue44603 I generally agree with your overall sentiment, but I think it's important to note that the behavior is _not_ special handling; it's just the normal `repr` behavior at the REPL, where `exit` is an object like any other, and `repr(exit)` is that message.
Python has a lot excuses about the need to remain "consistent" but the reality isn't so:
>>> x = open( "/tmp/whatever123", "w" )
>>> close( x )
Traceback (most recent call last):
File "", line 1, in
NameError: name 'close' is not defined. Did you mean: 'cosh'?
...
>>> x.close()
>>>
>>> x = "tttt"
>>> x.len()
Traceback (most recent call last):
File "", line 1, in
...
>>> len( x )
4Re: How many lines of C it takes to execute a + b in Python
#208Re: How many lines of C it takes to execute a + b in Python
#209Earlier quoted context omitted.
> Most languages with enough optimization works can be made performant enough that it's no slower than 10x C. Maybe if we take the slowest C program, CPython no slower than 50x ? https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
CPython had many other concerns besides from performance, and PyPy is much closer to my quote I believe.
fwiw PyPy doesn't seem to have been released in "the late 1990s".
Re: How many lines of C it takes to execute a + b in Python
#210Earlier quoted context omitted.
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
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!