Marc:
I compiled an image processing application with mostly-fixnum and mostly-fixnum-flonum and here is what I found:
[lindv2:Arrays/srfi3/gsc-test] lucier% ll total 107960 -rw-r--r-- 1 lucier lucier 4103052 Mar 21 15:51 all.c.fixnum -rw-r--r-- 1 lucier lucier 5489576 Mar 22 21:15 all.c.fixnum-flonum -rw-r--r-- 1 lucier lucier 6556015 Mar 22 20:28 all.i.fixnum -rw-r--r-- 1 lucier lucier 8689958 Mar 22 21:15 all.i.fixnum-flonum -rw-r--r-- 1 lucier lucier 1811056 Mar 22 20:45 all.o.fixnum -rw-r--r-- 1 lucier lucier 2492112 Mar 22 21:45 all.o.fixnum-flonum -rwxr-xr-x 1 lucier lucier 1449209 Mar 22 20:46 all.o1.fixnum* -rwxr-xr-x 1 lucier lucier 2029916 Mar 22 21:45 all.o1.fixnum- flonum* -rw-r--r-- 1 lucier lucier 5280685 Mar 22 20:45 all.s.fixnum -rw-r--r-- 1 lucier lucier 7388908 Mar 22 21:45 all.s.fixnum-flonum -rw-r--r-- 1 lucier lucier 558 Mar 22 21:15 all.scm -rw-r--r-- 1 lucier lucier 1631997 Mar 22 22:01 fixnum-expansion.scm -rw-r--r-- 1 lucier lucier 2151785 Mar 22 21:49 fixnum-flonum- expansion.scm -rwxr--r-- 1 lucier lucier 371 Mar 21 15:43 gaussian-random.scm* -rwxr--r-- 1 lucier lucier 88397 Mar 21 15:45 generic-arrays.scm* -rwxr--r-- 1 lucier lucier 25985 Mar 21 15:46 multi-calculus.scm* -rw-r--r-- 1 lucier lucier 6683 Mar 21 15:48 pgm.scm -rwxr--r-- 1 lucier lucier 9778 Mar 21 15:43 pixel-method.scm* -rwxr--r-- 1 lucier lucier 7113 Mar 21 15:46 point.scm*
You can see the size of the .scm files, the .c files, the .i files after macro expansion, the .s files, etc.
On a 2GHz Mac G5, the mostly-fixnum version took 2.4GB and 17 minutes to compile and the mostly-fixnum-flonum version took 3.4GB and 30 minutes to compile. This was with gcc-4.1.0 and not the compiler that apple ships (since the compiler that apple ships is 32-bit and can't allocate over 2.0 GB ;-).
The mostly-fixnum-flonum code is not as big as one might expect, for the following reasons:
1. If you have (+ i 1), then because 1 is not a flonum, it doesn't generate the tests or the code for flonum.+.
2. Comparisons are relatively simple, e.g., (< x y) just adds "check whether x and y are flonums and compare them" to the code, no boxing, etc.
So I don't see mostly-flonum-fixnum as that much of an added burden over mostly-fixnum.
Brad
Afficher les réponses par date