[Newbies] Primitives and array computation

Bert Freudenberg bert at freudenbergs.de
Thu Jul 10 17:38:14 UTC 2008


Am 10.07.2008 um 18:47 schrieb Frederic Dambreville:

> So, my question is: does the VM implements primitives for computing
> mathematical functions on arrays?


Generally, no. It's also hard to do in a general Array, since each  
Float is a full object, any arithmetic on it does unboxing and boxing  
of a newly allocated Float object. To speed this up considerably you  
would have to create primitive array that do not hold objects but.

There is the class FloatArray which works on a primitive array of 32- 
bit floats, but only very basic operations are supported by the  
FloatArrayPlugin.

- Bert -




More information about the Beginners mailing list