cfbolz changed the topic of #pypy to: #pypy PyPy, the flexible snake | IRC logs: and | the pypy angle is to shrug and copy the implementation of CPython as closely as possible, and staying out of design decisions
derpydoo has joined #pypy
jcea has quit [Ping timeout: 246 seconds]
derpydoo has quit [Ping timeout: 240 seconds]
<cfbolz> ctismer: dicts are slow? if you know it's ascii use a list instead ;-)
<ctismer> cfbolz: It is against PyPy‘s principles to change code, I thought. I wanted to show how ridiculous this kind of optimization is, because PyPy lets the difference vanish. But that result made me shut up 😳
<cfbolz> ctismer: sure, but you can't expect *every* code to get magically faster with pypy
derpydoo has joined #pypy
<ctismer> Astonishing is that the senior solution got slower in PyPy. Is the C implementation used?
<nimaje> does that benchmark even warmup the jit? and I would expect that the python implementation of collections from cpython is used, does cpython have a drop-in extension module for that?
<ctismer> nimaje: you have all soulce code above. Answer yourself.
<nimaje> no idea, from the code itself I expect it not to, but I don't know the details of warming up pypys jit
<cfbolz> yeah, it seems CPython has a C version for creating a counter from an iterable that we don't have
<ctismer> cfbolz: so do we fall back to the Python version? Or are we wrapping the C extension?
<ctismer> nimaje: It also gets more complex since CPython 3.11 has its own warmup meanwhile. I played with the numers and could not see any effect, though.
<cfbolz> ctismer: python version
<cfbolz> yeah, the JIT could do a little bit better with the python version (but I think being just 50% slower than C code with the JIT is a pretty decent result?)
<cfbolz> yeah, I see like three (small) problems in the JIT trace that could be addressed
<ctismer> cfbolz: Python 3.11 vs. PyPy 3.9
otisolsen70 has joined #pypy
<cfbolz> ctismer: no, i answered your question: we fall back to the pure python version
<ctismer> cfbolz: Ok, then at least the junior and senior solutions are almost equal. I can claim that the diff is neglectible on PyPy. That good result was just shadowed by CPython being faster on senior. I think to be fair I should test Python 3.10 as well (no bytecode switching)
marvin_ has quit [Remote host closed the connection]
marvin_ has joined #pypy
Techcable has quit [Ping timeout: 276 seconds]
Techcable has joined #pypy
derpydoo has quit [Ping timeout: 240 seconds]
lritter has joined #pypy
nimaje has quit [Quit: WeeChat 3.7]
nimaje has joined #pypy
Asgaroth has joined #pypy
jcea has joined #pypy
nimaje has quit [Quit: WeeChat 3.8]
nimaje has joined #pypy
<ctismer> cfbolz: In fact, the ASCII version of the algorithm lets PyPy shine! :) Here is the updated benchmark:
<ctismer> Deep-Thought:pyside-setup tismer$ python3.10
<ctismer> Junior 0.5864272500039078
<ctismer> Senior 0.2412864999496378
<ctismer> Ascii 0.5333902079728432
<ctismer> Deep-Thought:pyside-setup tismer$ python3.11
<ctismer> Senior 0.2525289579643868
<ctismer> Junior 0.4908035419648513
<ctismer> Ascii 0.37747079198015854
<ctismer> Deep-Thought:pyside-setup tismer$ pypy3
<ctismer> Junior 0.3905433749896474
<ctismer> Senior 0.3264245419995859
<ctismer> Ascii 0.025220041978172958
<cfbolz> Nice
nimaje has quit [Quit: WeeChat 3.8]
nimaje has joined #pypy
lritter has quit [Quit: Leaving]
Asgaroth has quit [Quit: Leaving]
otisolsen70 has quit [Quit: Leaving]
greedom has joined #pypy
greedom has quit [Remote host closed the connection]
greedom has joined #pypy
pbsds has quit [Ping timeout: 276 seconds]