FROM : Jonathan del Strother
DATE : Fri Nov 16 19:41:39 2007
I have a root CALayer with around 250 child layers. Only 50 or so are
visible at a time, the rest have their opacity set to 0 (which I've
found to be far more performant that continuously removing and adding
child layers).
Every 0.2 seconds, I want to move one of these child layers to be
drawn on the top of everything else. I'm doing this by altering the
order of the root layer's sub layers. I haven't been able to find an
acceptable way of doing this. Everything I've tried will continuously
increase my virtual memory usage to ~3.5GB, before dropping back to
1.1GB every 10 seconds or so. While that drop happens, my application
performance drops massively, displaying a frame a second at best, on a
Mac Pro with 3GB RAM.
The obvious way of moving a sublayer to the front would appear to be :
[rootLayer insertSublayer:child above:[[rootLayer sublayers]
lastObject]];
where 'child' already exists within in the rootLayer's sublayers.
I've also tried variants along the lines of :
NSMutableArray* sublayers = [[rootLayer sublayers] mutableCopy];
[sublayers removeObject:child];
[sublayers addObject:child];
rootLayer.sublayers = sublayers;
[sublayers release];
Everything I've tried results in the excessive virtual memory usage
and a huge drop in performance.
If I give up on moving the child to the front, it runs perfectly : my
app sits happily at 120MB real / 1.1GB virtual memory, and updates
smoothly. It's only when trying to alter the sublayers array that
these problems kick in.
Any suggestions on getting around this?
Jon
DATE : Fri Nov 16 19:41:39 2007
I have a root CALayer with around 250 child layers. Only 50 or so are
visible at a time, the rest have their opacity set to 0 (which I've
found to be far more performant that continuously removing and adding
child layers).
Every 0.2 seconds, I want to move one of these child layers to be
drawn on the top of everything else. I'm doing this by altering the
order of the root layer's sub layers. I haven't been able to find an
acceptable way of doing this. Everything I've tried will continuously
increase my virtual memory usage to ~3.5GB, before dropping back to
1.1GB every 10 seconds or so. While that drop happens, my application
performance drops massively, displaying a frame a second at best, on a
Mac Pro with 3GB RAM.
The obvious way of moving a sublayer to the front would appear to be :
[rootLayer insertSublayer:child above:[[rootLayer sublayers]
lastObject]];
where 'child' already exists within in the rootLayer's sublayers.
I've also tried variants along the lines of :
NSMutableArray* sublayers = [[rootLayer sublayers] mutableCopy];
[sublayers removeObject:child];
[sublayers addObject:child];
rootLayer.sublayers = sublayers;
[sublayers release];
Everything I've tried results in the excessive virtual memory usage
and a huge drop in performance.
If I give up on moving the child to the front, it runs perfectly : my
app sits happily at 120MB real / 1.1GB virtual memory, and updates
smoothly. It's only when trying to alter the sublayers array that
these problems kick in.
Any suggestions on getting around this?
Jon
| Related mails | Author | Date |
|---|---|---|
| Jonathan del Strot… | Nov 16, 19:41 | |
| David Duncan | Nov 16, 19:48 | |
| Jonathan del Strot… | Nov 16, 19:54 | |
| David Duncan | Nov 16, 20:08 | |
| Jonathan del Strot… | Nov 19, 10:09 | |
| David Duncan | Nov 19, 10:49 | |
| Jonathan del Strot… | Nov 19, 11:02 | |
| Chris Ryland | Nov 19, 19:56 | |
| Jonathan del Strot… | Nov 22, 13:24 |






Cocoa mail archive

