<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: