[Vm-dev] [Vm-beginners] Stability of the external plugin interface

Levente Uzonyi leves at caesar.elte.hu
Mon May 25 16:55:15 UTC 2020


On Sun, 24 May 2020, tim Rowledge wrote:

> MiscPlugins? Wouldn't be surprised if they could all be dropped and the cog'd versions would run as fast.

Below is a benchmark measuring the primitive to calculate string and byte 
array hashes. The in-image variant is fully JIT-friendly: AFAIK all its 
message sends have jitted implementations (#bitAnd:, #size, #to:do:, #+, 
#basicAt:, #hashMultiply).

| b |
b := ByteArray new: 10000.
{[ b hashWithInitialHash: 0 ] benchFor: 1 seconds.
[ String stringHash: b initialHash: 0 ] benchFor: 1 seconds }.
#('88,500 per second. 11.3 microseconds per run. 0 % GC time.' '11,500 per 
second. 86.9 microseconds per run. 0 % GC time.')"

In this case, the primitive version is 7.7x faster on my machine.

The actual performance difference depends on the size of the collection.
For sizes smaller than 4, the primitive version is slower. That could 
probably be improved by making it a numberered primitive and providing a 
jitted version of the primitive; something that was done with 
#compare:with:collated: (see primitive 158).

At this point we clearly can't drop those primitives. Some of them is 
probably worth to add to the VM directly, others may not be necessary at 
all in the future.


Levente

>
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Strange OpCodes: DCVP: Destroy another Computer Via Phone-link


More information about the Vm-dev mailing list