<div dir="ltr"><span style="font-size:12.8px">Hi all,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">For a long time I was willing to add primitive #replaceFrom:to:with:<wbr>startingAt: in the JIT but did not take time to do it. These days I am showing the JIT to one of my students and as an example of how one would write code in the JIT we implemented this primitive together, Spur-only. This is part of commit 2273.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I implemented quick paths for byte objects and array-like objects only. The rationale behind this is that the most common cases I see in Pharo user benchmarks in the profiler is copy of arrays and byteStrings. Typically some application benchmarks would show 3-5% of time spent in copying small things, and switching from the JIT runtime to C runtime is an important part of the cost.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">First evaluation shows the following speed-ups, but I've just done that quickly in my machine:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Copy of size 0<br></div><div style="font-size:12.8px">    Array 2.85x</div><div style="font-size:12.8px">    ByteString 2.7x</div><div style="font-size:12.8px">Copy of size 1</div><div style="font-size:12.8px">    Array 2.1x</div><div style="font-size:12.8px">    ByteString 2x</div><div style="font-size:12.8px">Copy of size 3</div><div style="font-size:12.8px">    Array 2x</div><div style="font-size:12.8px">    ByteString 1.9x</div><div style="font-size:12.8px">Copy of size 8</div><div style="font-size:12.8px">    Array 1.8x</div><div style="font-size:12.8px">    ByteString 1.8x</div><div style="font-size:12.8px">Copy of size 64</div><div style="font-size:12.8px">   Array 1.1x</div><div style="font-size:12.8px">   ByteString 1.1x</div><div style="font-size:12.8px">Copy of size 1000</div><div style="font-size:12.8px">   Array 1x</div><div style="font-size:12.8px">   ByteString 1x</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Failure paths are quicker too.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">So I would expect some macro benchmarks to get 1 to 3% percent speed-up. Not as much as I expected but it's there.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Can someone who is good at benchmarks such as Levente have a look and provide us with a better evaluation of the performance difference ?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">PS: Sry for double post Levente. First one got rejected by vm-dev, wrong sender mail address.</div><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="font-size:12.8px">Clément Béra</span><div style="font-size:12.8px">Pharo consortium engineer</div><div style="font-size:12.8px"><a href="https://clementbera.wordpress.com/" target="_blank">https://clementbera.wordpress.com/</a><br></div><div style="font-size:12.8px"><span style="line-height:16px">Bâtiment B 40, avenue Halley 59650 </span><span style="font-weight:bold;line-height:16px">Villeneuve d'Ascq</span></div></div></div>
</div>