Re: [NSArray filteredAraryUsingPredicate:] performance?
Re: [NSArray filteredAraryUsingPredicate:] performance?
- Subject: Re: [NSArray filteredAraryUsingPredicate:] performance?
- From: Abhi Beckert <email@hidden>
- Date: Fri, 22 Oct 2010 14:40:25 +1000
On 2010-10-22, at 1:32 PM, Graham Cox wrote:
> On 22/10/2010, at 2:19 PM, Abhi Beckert wrote:
>
>> How much does performance/memory suffer from using filteredArrayUsingPredicate?
>
> You state it doesn't matter, then you worry that it might.
>
> With any question about optimisation, the question can only be answered by measuring the performance to see if it falls short of your requirements or not. Since you don't say what your requirements are and have not measured the performance against them, nobody can answer this.
I should clarify I did test the performance in this case, and it's pretty much instant.
But I want to make educated guesses about fetch techniques in future, rather than spend precious billable time testing every single case, only to find out I need to spend three hours refactoring my code. I've been doing things like this in PHP/MySQL for years and am used to knowing, before I write the code, what technique will deliver "good enough" performance while minimising bugs (optimisation is the root of all evil!). We've only recently started offering cocoa programming to our clients.
> All I will say is that on Mac (as opposed to iOS) filtering using a predicate is "fast enough" up to many thousands of objects and I've found it adequate for my needs, but YMMV. You'd probably be unable to match its performance by doing the filtering yourself, though you could beat it by changing your storage so that it is organised into sets that already match certain criteria. Also, as you're caching the result you'll only get hit once or whenever the predicate or content changes.
Thanks, that pretty much answers my question. Thanks! :-)
- Abhi_______________________________________________
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