cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
forgottenone has quit [Quit: Konversation terminated!]
Gustavo6046 is now known as TotallyNotGus
TotallyNotGus is now known as Gustavo6046
Gustavo6046 has quit [Quit: ZNC 1.8.2 - https://znc.in]
Gustavo6046 has joined #pypy
jcea has quit [Ping timeout: 260 seconds]
oberstet has quit [Remote host closed the connection]
<mattip> here is a benchmark where processing python3 str is 8x slower on PyPy than when using CPython + C-API
<mattip> the issue came up because the package is pure python, but has a _speedup module that reimplements using the C-API
<cfbolz> Ouch
<cfbolz> mattip: do you have a link to the speedup version too?
<cfbolz> The C code I mean?
<mattip> we are slower on the pure-python version. Here is a complete runnable
<mattip> here is the C file, it is not as compact as the python version
<cfbolz> I suspect just copying the C algorithm to python would be faster. The series of replaces not great
<cfbolz> Anyway: snow snow snow!
jacob22_ has quit [Quit: Konversation terminated!]
otisolsen70_ has joined #pypy
otisolsen70_ has quit [Client Quit]
otisolsen70 has quit [Ping timeout: 240 seconds]
forgottenone has joined #pypy
<mattip> running the script without the JIT gives exactly the same timing. I guess there is not much the JIT can do with those str.replace() calls
muke has joined #pypy
<cfbolz> mattip: yes
muke has quit [Remote host closed the connection]
muke has joined #pypy
jcea has joined #pypy
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/7486 [Carl Friedrich Bolz-Tereick: force build, py3.8]
muke has quit [Quit: Leaving]
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/7486 [Carl Friedrich Bolz-Tereick: force build, py3.8]
<cfbolz> mattip: our replace is bad, particularly if the search-string is 1 char
<mattip> the idea to chain str.replace().replace().replace() is going to be slow even if our replace is optimal: that is four passes over str.
<mattip> can we fuse those loops? That seems complicated
<mattip> the c-code does one pass and optimizes for no-marker-found
<cfbolz> mattip: agreed, handwriting this is definitely still better
<cfbolz> mattip: but still, the replace calls should be more efficient
jacob22 has joined #pypy
<mattip> ByteListBuilder uses the init_size argument in the initializer for newlist. Does StringBuilder ever use init_size?