[Adium-devl] AppleScript has some problems.

Evan Schoenberg evan.s at dreskin.net
Fri Sep 28 18:05:51 UTC 2007


Quoting David Smith <catfish.man at gmail.com>:

> if(!loadedOSVersion)
> 	isOnLeopardOrBetter = [NSApp isOnLeopardOrBetter];
>
>
> Somehow it showed up on my shark profile yesterday at around the same
> % as those image loads. Perhaps that was just a weird side effect of
> called [NSApplication sharedApplication] in +load.
>
>
> 									David
>
> On Sep 28, 2007, at 10:00 AM, Peter Hosey wrote:
>
>> On Sep 28, 2007, at 08:20:16, David Smith wrote:
>>> Out of curiosity, why are we checking in +initialize rather than
>>> using the standard static + if lazy initializer patter?
>>
>> if (!isOnLeopardOrBetter)
>> 	isOnLeopardOrBetter = [NSApp isOnLeopardOrBetter];
>>
>>>>
>> More to the point, why not just call [NSApp isOnLeopardOrBetter]?
>> It's not like it's an expensive computation. I don't see the big win
>> of caching it.


There's no real reason to cache it, as it is indeed a cheap call.  At  
the time I wrote it, I was thinking about the fact that the method is  
called a -ton- as the table column using it redraws... but -[NSApp  
isOnLeopardOrBetter] is certainly not a bottleneck. It just seemed  
wasteful to call a system-constant like that a dozens of times with  
each redraw.

-Evan

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





More information about the devel mailing list