MacOSX Performance
John M McIntosh
johnmci at smalltalkconsulting.com
Tue Jan 25 03:48:11 UTC 2005
On Jan 24, 2005, at 4:20 PM, Karsten Wolf wrote:
>
> VM3.8.1b2: 16126
> Using rectangles for damageCollection: 5463 msec
> Using regions for damageCollection: 3156 msec
>
> Using a list of rectangles with maximum size of 128 at 128 for caching:
> 2289 msec
3.8.5b1 with about 125 f/s max
17" PB
I ran it 10 times
31,455 3.8.5b1
8629 rectangle
8498 region
Some observations, Apple's Shark reports 5.4% lurking in Rgn Math, and
a few % in QDFlushPortBuffer. Although the drawing is less
I think the time is gobbled up in region management and flushing the
region description to the Display Service, where as the rectangle based
drawing
take more time, but not by much.
> VM3.8.1b2: 7406
> Using rectangles for damageCollection: 1101 msec
> Using regions for damageCollection: 539 msec
>
> Using a list of rectangles with maximum size of 128 at 128 for caching:
> 328
Commander new: 12. {More to get the time up}
13,431 3.8.5b1
1752 rectangle
1975 region
Apple's Shark reports 2% tied up in Rgn Math, and .5 % in
QDFlushPortBuffer. In this case rectangles are faster, they are smaller
than above.
Times are similar, but I'd prefer rectangles versus regions to avoid
excessive malloc work, and don't forget regions have an upper boundary,
so
technically you need a check to see if you are exceeding that, more
overhead.
These figures come from using this code, I'm not sure if the
differences you got is related to your code, or the machine.
Rectangle based code
{
static int pastTime=0,c=0;
int check;
static RgnHandle dirtyRgn = NULL;
static Rect dirtyRect = {0,0,0,0};
Rect rect;
if (dirtyRgn == NULL)
dirtyRgn = NewRgn();
rect.top = affectedT;
rect.left = affectedL;
rect.bottom = affectedB;
rect.right = affectedR;
if (EmptyRect(&dirtyRect))
dirtyRect = rect;
c++;
UnionRect(&dirtyRect,&rect,&dirtyRect);
if (((check = (ioMSecs() - pastTime)) > 7) || check < 0) {
if
(CFRunLoopIsWaiting(GetCFRunLoopFromEventLoop(GetMainEventLoop()))) {
RectRgn(dirtyRgn, &dirtyRect);
QDFlushPortBuffer(windowPort, dirtyRgn);
SetEmptyRgn(dirtyRgn);
SetRect(&dirtyRect,0,0,0,0);
pastTime = pastTime + check;
c = 0;
}
}
}
Region based
{
static int pastTime=0,c=0;
int check;
static RgnHandle dirtyRgn = NULL;
if (dirtyRgn == NULL)
dirtyRgn = NewRgn();
c++;
UnionRgn (dirtyRgn, maskRect, dirtyRgn);
if (((check = (ioMSecs() - pastTime)) > 7) || check < 0) {
if
(CFRunLoopIsWaiting(GetCFRunLoopFromEventLoop(GetMainEventLoop()))) {
QDFlushPortBuffer(windowPort, dirtyRgn);
SetEmptyRgn(dirtyRgn);
pastTime = pastTime + check;
c = 0;
}
}
}
--
========================================================================
===
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
|