Here is a comparison of the performance of the three index-mapping
schemes provided with the reference implementation of SRFI-25.
All tests were done on a PII/350Mhz with 256M RAM under Linux 2.2.17.
Implementations tested were Gambit-C 3.0 and Chicken 1024.
The array-representation used is `as-procedure.scm'. The test itself
consists just of
cat [gambit-prelude.scm] as-procedure.scm array.scm op-XXXX.scm \
ix-XXXX.scm arlib.scm test.scm list.scm >bench.scm
Optimization-switches:
Gambit:
(declare (standard-bindings) (extended-bindings) (fixnum) (not interrupts-enabled))
-O3 -fomit-frame-pointer -D___SINGLE_HOST
Chicken:
-optimize-level 2 -fixnum-arithmetic -disable-interrupts
-O3 -fomit-frame-pointer -fstrict-aliasing
Gambit(unsafe):
(declare (standard-bindings) (extended-bindings) (fixnum) (not interrupts-enabled) (not safe) (block))
-O3 -fomit-frame-pointer -D___SINGLE_HOST
Chicken(unsafe):
-benchmark-mode
-O3 -fomit-frame-pointer -fstrict-aliasing
Gambit Chicken Gambit(unsafe) Chicken(unsafe)
ctor 1.60 0.46 0.29 0.24
mbda 1.44 0.51 0.36 0.32
tter 1.43 0.50 0.33 0.28
(I tried Stalin and mzc also, but they both failed either while
compiling (Stalin 0.9) or when executing (Mzc 103))
It seems that with all optimizations the ctor indexing is
the fastest - most of the work done in `op-ctor.scm' involves
primitive vector- and math-operations that can be optimized
nicely by the compiler if generic arithmetic is switched off.
Of course much of the code can be tuned to a specific implementation,
and this will change the timings accordingly. This is just an attempt
to find a general idea about performance of the reference implementation(s).
(Multiple values under Gambit have been simulated with simple lists, so
there is a lot of room for improvement).
All files (makefile, SRFI-25 ref.impl. with some minor bugs fixed
and preludes for Gambit) can be obtained at
http://www.call-with-current-continuation.org/srfi-25-bench.tar.gz
cheers,
felix