On Sep 23, 2009, at 12:31 PM, Aubrey Jaffer wrote: > In uncontrived programs which use bignums, small integers are used > much more than bignums. So although you can improve the time > performance of huge multiplications with an external MP package, > overall performance will suffer unless the MP package is only used for > large numbers.
Typically this is done with an integer tagging scheme. I've seen three or four bits per tag used, giving around 27-28 bits plus a sign bit on a 32-bit word size machine, and 57-58 on a 64-bit machine. Given that arithmetic functions must check the number-ness of the arguments already, and distinguish between exact and inexact numbers, this doesn't really add much cost: it's just another label in a case statement, and can be handled easily as a computed jump. -- Brian Mastenbrook [email protected] http://brian.mastenbrook.net/ _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
