MacOSX Performance

John M McIntosh johnmci at smalltalkconsulting.com
Tue Jan 25 06:34:28 UTC 2005


On Jan 24, 2005, at 9:41 PM, Karsten Wolf wrote:

> Intuitively I prefer rectangles too but I think it's ok to use regions  
> for damage collection in this special case. A region gets added 1  
> rectangle for each ioShowDisplay() call. I never profiled my region  
> adds...
>

Well I'll argue against using regions, athought we might fit into the  
region max size (not 100% sure) we are invoking lots of mallocs and  
remallocs This churns the poor C memory allocation logic.

>
>> if (((check = (ioMSecs() - pastTime)) > 7) || check < 0) {
> Aren't you using your deferrence counter "c"? Like:
> 	if ( ((check = (ioMSecs() - pastTime)) > 7) || (check < 0) || (c >  
> someLimit) ) {

No, I was just using it to see how much was cached in when viewing the  
running system via the  debugger.  The check < 0 is to handle clock  
rollover, mind I've not written an SUnit so I think it works...

>
>> if  
>> (CFRunLoopIsWaiting(GetCFRunLoopFromEventLoop(GetMainEventLoop()))) {
> I must confess this line is most interesting to me. Looks like stuff  
> that solves a problem...

Yes this prevents the flush from running when the carbon main event  
loop, which is really a CFRunLoop
is running. As mentioned earlier when the CFRunLoop wakes  up to  
process a mouse click/movement/etc it
runs the run loop observers as part of that process. One of  these  
handy observers wants to flush any dirty regions on windows we own
under some sort of unknown objective. However since the  
QDFlushPortBuffer is not thread safe I do not want
the interpret.c thread which is invoking a QDFlushPortBuffer collide  
with the CFRunLoop which is running
a QDFlushPortBuffer. That results in a core dump.  So the trick is  
where does the RunLoop think it is.

Mind
a) There is a window of opportunity were I'm checking state, seeing  
things are fine, then scheduling the QDFlushPortBuffer and then the  
runloop rims which
then attempts a QDFlushPortBuffer. However in testing without the check  
you can generate a core dump within 10 seconds. But I've tested this  
code
overnight and have not had issues yet so the exposure to this problem  
must be small.

{ mmm on retrospect I wonder if I need this now before I was talking to  
the QD dirty region and DID need this, now we're back to doing just the  
flush, oh well let me test that again tonight}

A quick peek implies it's not needed anymore... Sigh, well let me  
confirm that first.


--
======================================================================== 
===
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