[Pharo-users] question about primitives

Ben Coman btc at openInWorld.com
Sun Mar 23 12:56:25 EDT 2014


Werner Kassens wrote:
> Hi,
> i dont know anything about primitives or the vm, hence this could very 
> well be an extremely stupid question, but anyway:
>
> i use pharo 2.0 Latest update: #20628 and (i think) pharo VM version: 
> 3.9-7. (btw how do i look up the vm version?).
>
> in the package Collections-Arithmetic there is this method 
> FloatArray>>dot:
>
> dot: aFloatVector
>     "Primitive. Return the dot product of the receiver and the argument.
>     Fail if the argument is not of the same size as the receiver."
>     | result |
>     "<primitive:'primitiveFloatArrayDotProduct'>"
>     self size ......bla bla
>
> when i change this to:
>
> dot: aFloatVector
>     "Primitive. Return the dot product of the receiver and the argument.
>     Fail if the argument is not of the same size as the receiver."
>     | result |
>     <primitive: 'primitiveDotProduct' module: 'FloatArrayPlugin'>
>     "<primitive:'primitiveFloatArrayDotProduct'>"
>     self size ......bla bla
>
> it becomes much faster, iow it uses the primitive, and it seems to 
> produce the same results. hence my question, was it perhaps just 
> overlooked, that the primitive has a new name, or what is the reason 
> for not using it?
> werner
>
>
Hi Werner,

Sorry I'm not able to answer your question - but I'm curious.... with 
your espoused lack of vm knowledge :) how did you find that the second 
primitive even existed?  (I might like to follow the same path)

cheers -Ben




More information about the Pharo-users mailing list