NSColor colorUsingColorSpace: extremely slow on 10.6?
NSColor colorUsingColorSpace: extremely slow on 10.6?
- Subject: NSColor colorUsingColorSpace: extremely slow on 10.6?
- From: Aaron Epstein <email@hidden>
- Date: Thu, 12 Nov 2009 13:29:18 -0500
Hi all,
I've got some simple color space conversion code using NSColor's
colorUsingColorSpace: method that runs fast on 10.5, but is extremely slow
on 10.6 (especially in a loop run 1,000+ times). Has anyone else noticed
this issue? Are there any known workarounds?
I've attached some sample code below. Any insight or assistance would be
greatly appreciated!
Thanks,
Aaron
----
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Start!");
NSColorSpace *rgbSpace = [NSColorSpace deviceRGBColorSpace];
NSColorSpace *cmykSpace = [NSColorSpace deviceCMYKColorSpace];
NSColor *rgbColor, *cmykColor;
//All of the conversions below work extremely fast on 10.5.
int i;
for (i = 0; i < 1000; i++)
{
// SLOW on 10.6: system RGB color -> colorUsingColorSpace: ->
deviceCMYKColorSpace
rgbColor = [NSColor colorWithDeviceRed:1.0 green:0 blue:0 alpha:1.0];
cmykColor = [rgbColor colorUsingColorSpace:cmykSpace];
/*
// SLOW on 10.6: NSCustomColorSpace RGB color -> colorUsingColorSpace: ->
deviceCMYKColorSpace
CGFloat rgbComponents[4] = {1.0, 0, 0, 1.0};
rgbColor = [NSColor colorWithColorSpace:rgbSpace components:rgbComponents
count:4];
cmykColor = [rgbColor colorUsingColorSpace:cmykSpace];
*/
/*
// FAST on 10.6: system RGB color -> colorUsingColorSpaceName: ->
NSDeviceCMYKColorSpace
rgbColor = [NSColor colorWithDeviceRed:1.0 green:0 blue:0 alpha:1.0];
cmykColor = [rgbColor colorUsingColorSpaceName:NSDeviceCMYKColorSpace];
*/
/*
// SLOW on 10.6: NSCustomColorSpace RGB color -> colorUsingColorSpaceName:
-> NSDeviceCMYKColorSpace
CGFloat rgbComponents[4] = {1.0, 0, 0, 1.0};
rgbColor = [NSColor colorWithColorSpace:rgbSpace components:rgbComponents
count:4];
cmykColor = [rgbColor colorUsingColorSpaceName:NSDeviceCMYKColorSpace];
*/
}
NSLog(@"Done!");
[pool release];
return NSApplicationMain(argc, (const char **) argv);
}
_______________________________________________
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