Reduce CPU usage in screensaver?
Reduce CPU usage in screensaver?
- Subject: Reduce CPU usage in screensaver?
- From: Gabriel Zachmann <email@hidden>
- Date: Thu, 24 Sep 2009 20:43:09 +0200
I wrote a screen saver that basically zooms images at a frame rate of
10 frames/sec.
When running, it uses about 60% CPU !
This could be a bit annoying sometimes, if there are other compute
intensive processes running, such as video conversions.
Is there anything I could do to reduce the CPU usage of my screensaver?
(Other than reducing the frame rate?)
The method that seems to be the most compute intensive one is the
following:
[imageRep_ drawInRect: zoomed_frame_ fromRect: NSZeroRect operation:
NSCompositeCopy fraction: 1.0];
It gets invoked every frame (in -animateOneFrame, which computes a
slightly larger zoomed_frame_ every frame).
I analyzed my screen saver with Shark, and it says that this method
call costs about 85%.
If it helps, here is the complete source code: http://zach.in.tu-clausthal.de/tmp/ArtSaver.m
Any ideas or hints will be highly appreciated.
Best regards,
Gabriel.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden