otisolsen70 has quit [Remote host closed the connection]
otisolsen70 has joined #pypy
Atque_ has joined #pypy
Atque has quit [Ping timeout: 255 seconds]
Dejan_ has joined #pypy
Atque_ is now known as Atque
Dejan_ is now known as dejan
dejan is now known as Dejan
derpydoo has joined #pypy
Atque has quit [Ping timeout: 255 seconds]
Atque has joined #pypy
jcea has joined #pypy
derpydoo has quit [Remote host closed the connection]
<Hodgestar>
@cfbolz: It's sort of eerie seeing the string-concatenation-in-a-loop antipattern being discussed again and again over the years. Your post made me wonder if it is possible to speed this up in the JIT rather than at the level of Python string addition. I.e. for the JIT to see that there are repeated copies and allocations in a loop and to batch them up. The advantage the JIT has is that it doesn't have to worry internally about references unless they
<Hodgestar>
escape. I imagine it is pretty hard to beat the explicitly better algorithm of "".join() though. The runtime of the "for ...: a = a + b" version is quadratic unless some process can merge part of the + operations within the loop.
<cfbolz>
Hodgestar: the JIT already does some of that, it batches a+'.'+c for example. But doing it across iterations is harder
<cfbolz>
But while writing the post I was indeed thinking whether it would be possible somehow
<mattip>
maybe we could start with detecting the problem and emitting a warning
<Alex_Gaynor>
cfbolz: I _think_ the fact that we do one iteration of loop-unrolling should make it possible. At the boundary, somehow turning the VirtualStr you get from newstr into VirtualStringBuilder or something.
<Alex_Gaynor>
bu this is obviously very hand wavy
<cfbolz>
Alex_Gaynor: yes, exactly
<cfbolz>
Alex_Gaynor: it's a bit different from other virtual though, because it needs some actual non virtual memory
<Alex_Gaynor>
Yes, the similarity is that it's something you can "force". Unlike other virtuals you'd still be emitting instructions.
<Alex_Gaynor>
I guess it makes bridges potentially expensive? Or else you need to make them smarter -- accepting a virtual somehow?
<cfbolz>
Alex_Gaynor: they can accept virtual
<Alex_Gaynor>
I thought we always forced them in the bridge, before returning to the meta-interp?
<Alex_Gaynor>
I guess my knowledge is pretty out of date these days, its been a while.
<cfbolz>
Alex_Gaynor: there are some mechanisms if the bridge goes to the loop itself to keep stuff virtual
<Alex_Gaynor>
nice
<krono>
cfbolz: nice little blogpost :)
<cfbolz>
Thx
jinsun has joined #pypy
otisolsen70 has quit [Read error: Connection reset by peer]
MiguelX413 has quit [Read error: Connection reset by peer]
MiguelX413 has joined #pypy
jcea has quit [Read error: Connection reset by peer]