Primitive replaceFrom:to:with:startingAt: in the JIT

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Primitive replaceFrom:to:with:startingAt: in the JIT

Clément Bera-4
 
Hi all,

For a long time I was willing to add primitive #replaceFrom:to:with: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.

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.

First evaluation shows the following speed-ups, but I've just done that quickly in my machine:

Copy of size 0
    Array 2.85x
    ByteString 2.7x
Copy of size 1
    Array 2.1x
    ByteString 2x
Copy of size 3
    Array 2x
    ByteString 1.9x
Copy of size 8
    Array 1.8x
    ByteString 1.8x
Copy of size 64
   Array 1.1x
   ByteString 1.1x
Copy of size 1000
   Array 1x
   ByteString 1x

Failure paths are quicker too.

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.

Can someone who is good at benchmarks such as Levente have a look and provide us with a better evaluation of the performance difference ?

Thanks.

PS: Sry for double post Levente. First one got rejected by vm-dev, wrong sender mail address.


--
Clément Béra
Pharo consortium engineer
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
Reply | Threaded
Open this post in threaded view
|

Re: Primitive replaceFrom:to:with:startingAt: in the JIT

timrowledge
 

> On 23-10-2017, at 3:36 AM, Clément Bera <[hidden email]> wrote:
>
> Hi all,
>
> 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.

1% for a day or two’s work is a good trade. Spend a year doing that and you’ve better than doubled performance.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful Latin Phrases:- Fac me cocleario vomere! = Gag me with a spoon!