Skip to content
Prev 4666 / 15075 Next

quartz device extremely slow (2.7.0)

Just a wild guess (not using 2.7.0): maybe there is some memory  
allocation going on Quartz-internally, and the block size has changed  
between Tiger and Leopard?

The following sample code from apple might be related, it shows and  
measures performance of 4 different ways of drawing lines: (1) as  
separate CGPaths, (2) as a single CGPath, (3) using the new bulk line  
drawing function in Tiger, and (4) by limiting the number of lines  
drawn: http://beta.devworld.apple.com/samplecode/QuartzLines/ 
QuartzLines.zip

In a nutshell,
(1) for() { CGContextBeginPath(); CGContextMoveToPoint();  
CGContextAddLineToPoint(); CGContextStrokePath(); }
(2) CGPathCreateMutable(); CGPathMoveToPoint(); for ()  
{ CGPathAddLineToPoint(); }
(3) /* construct point array in memory, then */  
CGContextStrokeLineSegments();
(4) as (3), but use fewer points. not quite as accurate due to  
undersampling

On my system, benchmark results are
(1) 28.1 ms (10000 lines, 356k lines/sec)
(2) 4.9 ms  (10000 lines, 2053k lines/sec)
(3) 4.0 ms  (10000 lines, 2484k lines/sec)
(4) 1.6 ms  (898 lines, 561k lines/sec)

The current approach used in RQuartz_Polylines, (1), seems to be  
slower than what can be achieved by, e.g., using (2) or (3).
On Apr 27, 2008, at 16:36, Tomas Mikoviny wrote:

            
----
Jochen Laubrock, Dept. of Psychology, University of Potsdam, Germany