>
http://www.suri.cs.okayama-u.ac.jp/~niitsuma/scm2cpp/scm2cpp-0.7-comm...
>
> Benchmark shows scm2cpp 3 times faster than Gambit-C.
> (10 times faster with -O3 ?)
>
> Gambit-C
>
> $ time ./fft-gambit
> real 0m16.797s
> user 0m13.046s
> sys 0m0.135s
>
> scm2cpp
> $ time ./fft.exe
> real 0m5.202s
> user 0m4.298s
> sys 0m0.029s
>
> scm2cpp with g++ -O3
>
> $ time ./fft-O3
> real 0m0.984s
> user 0m0.807s
> sys 0m0.005s
>
> used codehttp://
www.suri.cs.okayama-u.ac.jp/~niitsuma/scm2cpp/benchmark/fft.scm
>
> Environment MacBook core2duo 2.26Ghz
>
> $ uname -a
> Darwin 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT
> 2011; RELEASE_I386 i386
Yes, that's true, for that fft code from the Gabriel benchmarks, which
was written in a style for Common Lisp, and massaged to run fast on
Stalin. On my Mac laptop, I get running on Gambit:
[Bradley-Luciers-MacBook-Pro:~/Desktop] lucier% time ./fft
11.339u 0.111s 0:11.45 99.9% 0+0k 0+0io 0pf+0w
On the other hand, if you extract the FFT code from lib/_num.scm in
the Gambit source code, put
(declare (standard-bindings)
(extended-bindings)
(block)
(not safe)
)
at the top, and run the following benchmark:
(define (test n)
(define (flsquare x) (fl* x x))
(let ((two^n
(expt 2 n))
(table
(time (make-w (fx- n 1)))))
(let ((a
(make-f64vector (fx* two^n 2)))
(inexact-two^n
(fixnum->flonum two^n)))
(do ((i 0 (fx+ i 1)))
((fx= i (fx* two^n 2)))
(f64vector-set! a i (fixnum->flonum i)))
(time (do ((i 0 (fx+ i 1)))
((fx= i 1000))
(direct-fft-recursive-4 a table)
(inverse-fft-recursive-4 a table)
(do ((i 0 (fx+ i 1)))
((fx= i (fx* two^n 2)))
(f64vector-set! a i (fl/ (f64vector-ref a i)
inexact-two^n)))))
(do ((i 0 (fx+ i 1))
(error 0. (fl+ error (flsquare (fl- (f64vector-ref a i)
(fixnum->flonum i))))))
((fx= i (fx* two^n 2))
(display (flsqrt error))
(newline))))))
(test 10)
which does twice as much work as your benchmark (because it does 1000
forward and 1000 backward transforms), then it runs in
(time (do ((i 0 (fx+ i 1))) ((fx= i 1000)) (direct-fft-recursive-4 a
table) (inverse-fft-recursive-4 a table) (do ((i 0 (fx+ i 1))) ((fx= i
(fx* two^n 2))) (f64vector-set! a i (fl/ (f64vector-ref a i) inexact-
two^n)))))
60 ms real time
60 ms cpu time (60 user, 0 system)
no collections
160000 bytes allocated
22 minor faults
no major faults
on my machine.
So this program on Gambit runs over 300 times faster than the Gabriel
benchmark program on Gambit.
I don't see why someone interested in fast FFTs would care how fast
the Gabriel benchmark program runs on Gambit (or, perhaps, on any
other system).
Brad