Squeak is doing a *lot* of gettimeofday()
Scott A Crosby
crosby at qwes.math.cmu.edu
Tue Feb 12 19:58:10 UTC 2002
On Tue, 12 Feb 2002, John M McIntosh wrote:
> >Scott say:
> >> Although John's solution works, its not the ideal; it makes the checks a
> >> little cheaper, but does not remove them. This still leaves behind a
> >> noticable overhead. While, THIS:
> >
> >It should make them a *LOT* cheaper: it's a variable read versus a
> >system call.
>
> On many high end cpus the variable read kinda disappears into the
> clutter as multiple logic units fiddle with the instruction stream.
> The timeofday is *way* more expensive, perhaps a million times.
The variable read may, but the function call overhead doesn't.. Yes, it
makes it about 10x cheaper. But the correct solution is to *not* read the
clock 40,000 times a second. Andreas Raab's patch (which I referenced)
reduces this. If you don't read it 40,000 times a second, you're not
invoking 40,000 or more functions/second, and its going to be better.
ar's fix is generally applicable, for all platforms. Sure, go for ITIMER
for UNIX to make the 4000 invocations/second cheaper, but go for ar's
patch so it reads the clock 36000 times fewer a second.
Scott
More information about the Squeak-dev
mailing list
|