On Fri, 10 Jun 2016, Ludovic Courtès wrote:
Jan Wedekind <[email protected]> skribis:
Here is an example adding an integer to each element of a 2D array
and returning the result:
scheme@(guile-user)> (use-modules (oop goops) (aiscm jit) (aiscm int)
(aiscm pointer) (aiscm sequence))
scheme@(guile-user)> (+ (arr (2 3 5) (7 11 13)) 3)
$1 = #<sequence<sequence<int<8,unsigned>>>>:
((5 6 8)
(10 14 16))
The fallback method for the GOOPS generic "+" adds a JIT compiled
plus operation for the specific array types to the generic and then
calls "+" again.
Woow, exciting stuff! It can surely make a different for number
crunching applications.
Ludo’.
Yes, here are some examples with empty arrays and arrays with 250,000
elements. I hope that the upcoming Guile version 2.2 will help increase
performance as well.
$ make bench
Making bench in bench
make[1]: Entering directory '/home/jan/test/aiscm/bench'
LD_LIBRARY_PATH=./.libs:/usr/local/lib GC_INITIAL_HEAP_SIZE=1G
GC_USE_ENTIRE_HEAP=Y /usr/bin/guile bench.scm
user system total
real
Guile GOOPS method dispatch 0.000040 0.000000 0.000040 (
0.000040)
Guile make empty sequence 0.000150 0.000000 0.000150 (
0.000140)
Guile allocate memory 0.000190 0.000000 0.000190 (
0.000200)
Guile negate empty sequence 0.001580 0.000110 0.001690 (
0.001690)
Guile make sequence 0.000230 0.000010 0.000240 (
0.000240)
Guile negate sequence 0.002400 0.000930 0.003330 (
0.003350)
C allocate memory 0.000060 0.000000 0.000060 (
0.000060)
C negate empty sequence 0.000030 0.000000 0.000030 (
0.000030)
C negate sequence 0.000730 0.000000 0.000730 (
0.000720)
make[1]: Leaving directory '/home/jan/test/aiscm/bench'
Regards
Jan