[vlc-devel] [vlc-commits] macosx: dynamically create context and main sub menu for playlist table header selection , Simplifications in existing code

David Fuhrmann david.fuhrmann at googlemail.com
Sun Aug 19 20:58:51 CEST 2012


Am 19.08.2012 um 19:59 schrieb Felix Kühne <fkuehne.videolan at gmail.com>:

> On Sun, Aug 19, 2012 at 6:09 PM, David Fuhrmann <git at videolan.org> wrote:
>> vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Aug 19 16:41:49 2012 +0200| [f956a68eb889593c3aa194004dbe984f5633145c] | committer: David Fuhrmann
>> 
>> macosx: dynamically create context and main sub menu for playlist table header selection, Simplifications in existing code
>> 
> 
>> +    NSMenuItem *o_mi_tmp;
>> +    for( NSUInteger i = 0; i < [o_ptc_menuorder count]; i++ )
>> +    {
>> +        NSString *o_title = [o_ptc_translation_dict objectForKey:[o_ptc_menuorder objectAtIndex:i]];
> 
> Please consider to cache the array count in an NSUInteger to save 9
> Obj-C selector calls. This will speed-up things a lot (while probably
> not too noticeable in this context).

Hmm, I'm accustomed to that structure too much probably. I use that quite often in Java / C++. Has this Obj-C selector call such a bad performance, really? :-)
This method is only called once per start, so I don't think that the additional calls are noticeable. But of course I will keep that in mind for further code.

IMHO, they are many places where there is much more resource-intensive code which could be optimized with additional caching. For example, one indexOfObject call I used will probably take longer than the 9 count calls.

Best regards,
David


More information about the vlc-devel mailing list