fetchClassOf & commonSend?

Tim Rowledge tim at sumeru.stanford.edu
Thu Dec 13 19:34:43 UTC 2001


John M McIntosh <johnmci at smalltalkconsulting.com> is widely believed to have written:

> I was thinking about this.
> What if you did some samples to decide how long the primitives ran.
> 
> Say start with an array of flags to indicate if we should check the clock
> for the primitive in question. If we don't know the state of the flag 
> then collect a few samples of duration, then based on the numbers set 
> the flag as required.  That way you allow the system to decide, 
> versus a human. Also helps make correct decisions based on machine 
> performance. Anyone want to do this?
I feel pretty sure it _could_ be done, but also pretty sure it would be
about as time consuming as the original problem causing checks - unless
of course one used the flags to decide whether you need to check to see
if checking is needed :-) You'd need a table (how big? are external
prims included - if so do you have a big enough table? and if not...)
that would be read for every prim call and written for some. That would
probably have quite a cost, especially if one feels like worrying about
cache misses and so on. There is also some possibility of incorrect
results; imagine a prim that fails (quickly!) and causes said prim to be
tagged as fast when in fact the normal use of the prim takes a long time
(net fetching, file access etc).

I think the neat thing about using Slang pragmas to encode the checks in
the prims themselves is that adding the cost of a clock check to a prim
that is almost certainly long running is a negligable cost. Leaving the
check out of a known quick prim is likely to be big saving.

tim

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Useful random insult:- Thinks "Private Enterprise" means owning a personal starship.





More information about the Squeak-dev mailing list