Speed of Quartz (was: optimizing compilers)
Speed of Quartz (was: optimizing compilers)
- Subject: Speed of Quartz (was: optimizing compilers)
- From: "Phil Barrett" <email@hidden>
- Date: Mon, 4 Feb 2002 10:02:57 -0000
Erik wrote:
>
I think that the combination of Quartz and broken Cocoa display semantics
is
>
slow because my company sells a high end vector animation application that
>
is much faster on a 266Mhz Pentium PC running Openstep than it is on a
>
450Mhz G4 running OS-X.
...
>
we are stuck with slow (but admittedly more capable) Quartz.
Absolutely. We have exactly the same problem with Quartz speed. One of our
apps needs to draw a sound waveform, fast enough to allow it to scroll in
real time while the sound is playing. The waveform is drawn as two series of
line segments, one segment for each horizontal pixel. In Quartz this is
simply:
NSBezierPath * path = [ NSBezierPath bezierPath ];
[path setLineWidth:1.0];
[path moveToPoint: NSMakePoint(x,y)];
{ // loop over points
[path lineToPoint: NSMakePoint(x,y)];
}
[path stroke];
The performance of Quartz was atrocious - it was taking up to half a second
to draw one screen's worth of waveform. We tried QuickDraw, but that was too
much of a pain. We tried OpenGL, which was fast, but couldn't handle fonts.
So we ended up using AppleGL. Sure, we get no nice antialiasing, but who
cares if it's the only way to get it to draw quickly?
(Please don't follow up with comments about restructuring our code to cache
the image etc. It's cross-platform and it works perfectly well on Windows,
so we're not going to change it unless we have to!)
Phil