[Pharo-users] question about primitives

Werner Kassens wkassens at libello.com
Sun Mar 23 10:54:40 EDT 2014


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




More information about the Pharo-users mailing list