question about primitives

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

question about primitives

wernerk
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

Reply | Threaded
Open this post in threaded view
|

Re: question about primitives

Ben Coman
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

Reply | Threaded
Open this post in threaded view
|

Re: question about primitives

wernerk
Hi Ben,
i stumbled upon
https://github.com/smarr/RoarVM/blob/master/vm/src/interpreter/obsolete_named_primitive_table.cpp
werner

On 03/23/2014 05:56 PM, Ben Coman wrote:

> 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
>
>

Reply | Threaded
Open this post in threaded view
|

Re: question about primitives

Sven Van Caekenberghe-2
I think this is an oversight, but I know nothing about that plugin or its history. So the primitive should be used correctly. It is probably best to make an issue.

On 23 Mar 2014, at 18:16, Werner Kassens <[hidden email]> wrote:

> Hi Ben,
> i stumbled upon https://github.com/smarr/RoarVM/blob/master/vm/src/interpreter/obsolete_named_primitive_table.cpp
> werner
>
> On 03/23/2014 05:56 PM, Ben Coman wrote:
>
>> 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
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: question about primitives

Nicolai Hess
but it looks like it never found its way into any pharo version.



2014-03-23 18:45 GMT+01:00 Sven Van Caekenberghe <[hidden email]>:
I think this is an oversight, but I know nothing about that plugin or its history. So the primitive should be used correctly. It is probably best to make an issue.

On 23 Mar 2014, at 18:16, Werner Kassens <[hidden email]> wrote:

> Hi Ben,
> i stumbled upon https://github.com/smarr/RoarVM/blob/master/vm/src/interpreter/obsolete_named_primitive_table.cpp
> werner
>
> On 03/23/2014 05:56 PM, Ben Coman wrote:
>
>> 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
>>
>>
>



Reply | Threaded
Open this post in threaded view
|

Re: question about primitives

wernerk
In reply to this post by Sven Van Caekenberghe-2
ok, i'll open an issue in the bugtracker
werner

Reply | Threaded
Open this post in threaded view
|

Re: question about primitives

Sven Van Caekenberghe-2
Not necessary, there already is an old one:

https://pharo.fogbugz.com/f/cases/3748

Thanks for reporting this.

On 23 Mar 2014, at 21:54, Werner Kassens <[hidden email]> wrote:

> ok, i'll open an issue in the bugtracker
> werner
>


Reply | Threaded
Open this post in threaded view
|

Re: question about primitives

wernerk
Oops, ive already done it, no 13122, can i somehow delete my issue?
werner

On 03/23/2014 10:06 PM, Sven Van Caekenberghe wrote:
> Not necessary, there already is an old one:
>
> https://pharo.fogbugz.com/f/cases/3748
>