[Vm-dev] Fwd: MiscPrimitive plugin: plan for next 6 months, please read

Levente Uzonyi leves at caesar.elte.hu
Sat Dec 23 23:01:12 UTC 2017


On Sat, 23 Dec 2017, Levente Uzonyi wrote:

> Here's the benchmark I wrote:
>
> data := #(0 1 2 3 4 5 10 20 50 100 200 500 1000) collect: [ :size |
>         | s primitive smalltalk overhead iterations |
>         Smalltalk garbageCollect.
>         s := String new: size withAll: $a.
>         iterations := 100000000 // (size max: 1).
>         overhead := [ 1 to: iterations do: [ :i | ] ] timeToRun.
>         primitive := [ 1 to: iterations do: [ :i | ByteString 
stringHash: s initialHash: 1 ] ] timeToRun.
>         smalltalk := [ 1 to: iterations do: [ :i | ByteString 
stringHash2: s initialHash: 1 ] ] timeToRun.
>         { size. primitive - overhead. smalltalk - overhead } ].

Forgot to mention that #stringHash2:initialHash: is the same method as 
#stringHash:initialHash: but without the primitive.

Levente


More information about the Vm-dev mailing list