[Vm-dev] Reed Solomon plugins & performance slow down

Levente Uzonyi leves at caesar.elte.hu
Tue Jun 1 00:05:44 UTC 2021


Hi Robert,

After a quick look, the problem seems to be that you're reading the first
parameter, selfCoefficientsOop with #stackIntegerValue:, but the parameter 
is an array, not an integer, so it needs to be read with #stackObjectValue:.
I don't think #stSizeOf: does any good when its argument is an integer 
oop, hence the crash.

For simplicity and efficiency, I suggest you should pass a WordArray to 
the primtive (and use WordArrays in the image as well). It maps to the 
unsigned ints the primitive uses, and you can use #firstIndexableField: 
safely.
Passing an Array would complicate things, as an Array can hold any kind of 
objects (which the primitive would have to check before using them), and 
its field size doesn't fit into an unsigned int on 64-bits.

Also, validation of the arguments should be strict in the primitive. Have 
a look at e.g. DESPlugin >> #primitiveDESTransform to see how it validates 
its two arguments, a ByteArray and a WordArray.


Levente

P.S.: If the coefficients fit into smaller fields, it's worth to use a 
ByteArray or a DoubleByteArray instead of a WordArray for better 
performance.


More information about the Vm-dev mailing list