[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] numbers egg slow?

From: Daishi Kato
Subject: Re: [Chicken-users] numbers egg slow?
Date: Thu, 06 Oct 2005 14:50:18 +0900
User-agent: Wanderlust/2.15.1 (Almost Unreal) Emacs/21.4 Mule/5.0 (SAKAKI)

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))'           
% csi -eval '(use numbers)(print (cpu-time))(let loop ([i 0]) (or (> i (expt 2 
17)) (loop (fx+ i 1))))(print (cpu-time))'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]