At Mon, 3 Oct 2005 20:40:00 +0200, felix winkelmann wrote: > Using numbers is definitely slower, since there is more dispatching > overhead on number types. The base system only has two numeric > types, which makes a type-check quite fast. The numbers egg has > to check for more possible types (and all these tests are implemented > in Scheme).
That is certainly understandable, except that I do not know if type-checking in scheme code is really slower than type-cheking in c code, if the scheme code is compiled properly or unsafely. (or inlined?) # Basically, there should not be any overhead from the code # IF fixnum? THEN do_fixnum_plus ELSE do_flonum_plus # to the code # IF fixnum? THEN do_fixnum_plus ELSE IF flonum? do_flonum_plus # ELSE IF bignum? do_bignum_plus ELSE IF ratnum? do_ratnum_plus # ELSE do_compnum_plus # ,when doing plus on fixnums. # Is it true? I also tried to compare with fx+. How would you explain this? % csi -eval '(print (cpu-time))(let loop ([i 0]) (or (> i (expt 2 17)) (loop (fx+ i 1))))(print (cpu-time))' 2 107 % csi -eval '(use numbers)(print (cpu-time))(let loop ([i 0]) (or (> i (expt 2 17)) (loop (fx+ i 1))))(print (cpu-time))' 3 992 Daishi _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
