fetchClassOf & commonSend?

John M McIntosh johnmci at smalltalkconsulting.com
Thu Dec 13 03:10:24 UTC 2001


>Marcel Weiher wrote:
>>
>>  On Dienstag, Dezember 11, 2001, at 06:21  Uhr, John M McIntosh wrote:
>>
>>  > Also 161 million calls to ioMSecs or 272,923 calls per second! but I
>>  > need to investigate that more...
>>
>>  That's the primitive code figuring out wether to check for interrupts or
>>  something.
>I suggested a way to avoid most of those calls some time ago; for many
>primitives we can be pretty sure they will take very little time and
>could thus not bother with the time check. Some other prims can take a
>wide range of times and thus ought to be quickly checked, while still
>others (pretty much anything to do with outside connectivity, files etc)
>would probably be reasonably assumed to be always take a long time.
>
>I suppose a pragma-like statement like the inlining statement could be
>used to mark prims for their status, and a default (for backwards
>compatible safety) would be to assume a long prim.
>
>Ought to be fairly simple to implement.
>
>tim

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?

Of course looking at why we need to do this is also interesting, it 
wants to call checkForInterrupts, so right now the os-x version and 
maybe all the Unix? versions invokes that every 1/50 of a second when 
primitives are being used.

Also a few years back (the sprint of 2000) I changed the logic in 
checkForInterrupts to reduce usage because it's also invoked on 
perform and performAt and via bytecodes 131 
(singleExtendedSendBytecode) and 167 (longUnconditionalJump). The 
code I put there moderates the calling frequency, or tries to, to 
about 1 call every 5 milliseconds by altering interruptCheckCounter 
which also gets set to zero in  numerious places to trigger a 
checkForInterrupts.

therefore under heavy prim usage we do a call every 1/50 of second, 
along with normally doing a call every 1/200 of a second.

But somehow doing away with lots of those clock calls seems a good thing todo.

-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================




More information about the Squeak-dev mailing list