Re: NSMutableDictionary and retirieving data from web
Re: NSMutableDictionary and retirieving data from web
- Subject: Re: NSMutableDictionary and retirieving data from web
- From: "Louis C. Sacha" <email@hidden>
- Date: Tue, 13 Apr 2004 21:46:25 -0700
Hello...
In his last comment, he is probably referring to using IMPs to call
methods directly as a function instead of using the normal
objective-C messaging. There is more information about doing this is
the description of the NSObject class method
instanceMethodForSelector: in the Foundation reference docs.
However, it is probably something that you should NOT consider doing
at this point. It's more important to get your basic code working
right, and not worry about doing optimizations (especially that kind
of optimization) until you can fully test your application and find
out whether you have a performance problem or not.
In general, using IMPs provides very little improvement in speed, and
other types of optimizations are much more effective. The amount of
extra time spent when an objective-C message is sent instead of
calling a function is usually negligible compared to the amount of
time it takes for the actual code in the method to be run, especially
since the implementation of most methods will end up sending messages
internally to other methods anyway. In your case, the total amount of
time spent sending messages while you parse the data will most likely
be insignificant compared to the amount of time spent fetching the
data from the web, or compared to the amount of time spent
allocating/initializing/building your model of the data (the arrays,
strings, dictionaries, etc...).
Also, you won't really see much improvement using IMPs unless you
call that particular method a very large number of times. If I
remember correctly, the Apple docs talk about calling a method 10^4
(ten thousand) times in a tight loop before seeing an improvement.
Personally, I would say it is probably closer to calling a method
10^6 (one million) times for most code to see any difference from
using the method pointer, but there are people who like using IMPs
that would probably disagree with that. Regardless, when he says
"many rows", you should probably be thinking in terms of many
thousands of rows, not 30 or 40 rows.
There may be rare places where using IMPs is an effective way to
speed up your code, but this is probably not one of them.
Louis
On Apr 13, 2004, at 09:07, Pandaa wrote:
...
(( And if you have many rows - remember to cache method pointers
for every method call you need to make on a per-row basis!! ))
Can you show me small example?
Thanks :)
/Ibrahim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.