[squeak-dev] Alien vs. FFI benchmarks (Re: Trying to load ALienOpenGL into 4.1 alpha...)

Lawson English lenglish5 at cox.net
Thu Mar 25 03:43:01 UTC 2010


Andreas Raab wrote:
> [...]
> This still takes 3589 msecs. Whoops, it did it again. Even with the 
> more elaborate use Alien is still 8x slower than the FFI. That's the 
> cost of doing marshalling in Squeak and the effect it has on Alien 
> performance when compared with the FFI.
>
> Cheers,
>   - Andreas
>
>
 Thanks so much for  for all of this, Andreas. BTW what is the overhead 
of a named primitive vs an unnamed primitive vs an FFI call?

My tests (perhaps not relevant):

[1 to: 1000000 do:[:i| i+2]] timeToRun.   18

 [1 to: 1000000 do:[:i| i+2.0]] timeToRun.  106

 [1 to: 1000000 do:[:i| 2.0 +2.0]] timeToRun.   121

 [1 to: 1000000 do:[:i| (FFITestLibrary ffiTestFloats: i with: 2.0)]] 
timeToRun.  2742

 [1 to: 1000000 do:[:i| (FFITestLibrary ffiTestFloats: 2.0 with: 2.0)]] 
timeToRun.  2556



where would a 


NPTestLibrary>>npTestFloats: 2.0 with: 2.0)


rank?

Would it ever be worth it to create a OpenGL plugin wrapper rather than 
use the FFI calls?



Lawson



More information about the Squeak-dev mailing list