On 3/15/08, Martin C. Martin <mmartin@...> wrote:
> One small suggestion: while the rdtsc values can be big (e.g. if the
> computer hasn't been reset in years), the difference should be small,
> small enough to fit in a fixnum. So the part that reads:
> (ash (- hi1 hi0) 32)
> Could be changed to:
> (the fixnum (ash (- hi1 hi0) 32))
> Similarly after the difference of the lo's is added.
> Or not, this isn't inside what you're trying to measure, so its not the
> performance critical part.
No need to lie to the compiler. The hi/lo values are declared
(unsigned-byte 32), so the subtractions are already done inline. What
should be declared is that the result of the hi/hi subtraction is
(unsigned-byte 32) too. After that, everything will be done inline
(with tests), and the slow bignum-consing path will never be taken.
That's on a 64 bit architecture, obviously. In any case, if that
matters, it's very probably a case of You're Doing It Wrong: the
logging overhead will introduce as much or even more noise anyway.