Re: Optimizing Screensaver
Re: Optimizing Screensaver
- Subject: Re: Optimizing Screensaver
- From: email@hidden (Simon Fraser)
- Date: Fri, 16 Jan 2004 13:54:19 -0800 (PST)
- Organization: AOL
Jurjan Dijkstra wrote on 16/1/04, 1:11 pm:
>
Hi list,
>
I'm making a screensaver (like everybody has done at one time or
>
another I guess).
>
>
My problem is that on 'slower' machines it's taking up to 40%
>
processor-utilization.
>
( found by ssh'ing into the machine and using top).
>
>
I would like to lower that percentage.
>
After all, all I'm doing is displaying some text (max about 7 small
>
lines)
>
(using: [[NSString stringWithFormat:@"%@",[teksten
>
objectAtIndex:i]] drawAtPoint:NSMakePoint(x_pos, y_pos[i])
>
withAttributes:attribuutjes];)
>
and some small picts
>
(using: [ster[1] compositeToPoint:NSMakePoint((([self
>
bounds].size.width - (grootte.height * 5)) / 2) + (i *
>
grootte.height), y_pos[[teksten count]]) fromRect:NSMakeRect( 0, 0,
>
grootte.height, grootte.height ) operation:NSCompositeSourceOver];)
>
and appleevents (querying iTunes (what else....))
>
>
I have NO idea where to start, and furthermore: how DOES one analyse
>
a screensaver while running??
>
After all, a screensaver (by definitiion) only runs when the user
>
isn't doing anything.
>
>
Does anybody have an idea on how to accomplish this??
Yes, I've done lots of screensaver optimization.
First, make a symlink in ~/Library/Screen Savers to your .saver bundle
in the build products directory (this saves copying it every time you
build). Then select this in the system prefs screensaver settings.
Then, set up a Custom Executable in Project Builder/Xcode for your
project, and select
/System/Library/Frameworks/ScreenSaver.framework/Versions/A/
Resources/ScreenSaverEngine.app
Add the "-background" argument. This allows your screensaver to be run
on the desktop. You could also launch ScreenSaverEngine.app with this
argument directly from the terminal.
Now run your screensaver in the background. Then you can use the various
perfomance tools to see where it's spending time. I suggest you start
with Sampler, then, if necessary, move onto the CHUD tools (search
http://developer.apple.com for more info).
Note that ScreenSaverEngine.app seems to have a bug where if you run it
with -background once, after that the screensaver hot corners no longer
work, and some other system keypress handling goes wonky.
Simon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.