[vlc-devel] [vlc-commits] macosx: dynamically create context and main sub menu for playlist table header selection , Simplifications in existing code
Felix Paul Kühne
fkuehne.videolan at gmail.com
Sun Aug 19 21:33:17 CEST 2012
On 19.08.2012, at 20:58, David Fuhrmann wrote:
>
> 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? :-)
Well, in a separate project with huge array structures (read: count ~ 200,000), optimizing this led to a performance increase from 8s to 1.5s when parsing the array. So, it's noticeable in real life, but not in this context.
However, this kind of stuff sums up too easily :-)
> 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.
This is quite likely, which is why I introduced proper indexing to said app above (reducing the process runtime by hours). However, this isn't worth the hassle here IMHO.
Best regards,
Felix
More information about the vlc-devel
mailing list