• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMutableDictionary and retirieving data from web
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableDictionary and retirieving data from web


  • Subject: Re: NSMutableDictionary and retirieving data from web
  • From: Pandaa <email@hidden>
  • Date: Wed, 14 Apr 2004 23:52:32 +0200

2004-04-14 kl. 06.46 skrev Louis C. Sacha:

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.

Of course.

In general, using IMPs provides very little improvement in speed,

Depends on what you're comparing.

and other types of optimizations are much more effective.

It's really orthogonal to other optimizations. And it's very simple, while other optimizations often involve complex algorithm re-design that not everyone has the education to do. And even then, the other optimizations have often already been made! There's no reason to avoid a last optimization that will commonly give a 5 to 20% speed improvement when it's trivial to implement.

But if you're in a learning stage or have more productive things to do, don't bother.

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,

Again, it's really orthogonal to that. I'm caching imps in a processing loop where every iteration does a few thousands point FFT and rectangular to polar conversions and it gave a small but noticeable improvement.

especially since the implementation of most methods will end up sending messages internally to other methods anyway.

You should of course do deeper method caching in those cases. It's obvious that caching one out of the usually few tens at most methods involved in a loop won't do much, but caching the few most common ones may.

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.

That is not consistent with my experiments. Eliminating a single message dispatch may not make a difference, but if you cache all implementations involved in a commonly executed code section it does. I had a 5 to 15% speed increase in my sound playback io code, for example. It of course helps if you can cache the imp once at load time.

A reason not to use method caching is that it makes the code look horrible. That's why it should ideally be either an automated optimization, or have a specialized compact syntax.

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.

Yes.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . earth water fire air software - the five elements . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. email@hidden . . www.synapticpulse.net .
_______________________________________________
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.


References: 
 >NSMutableDictionary and retirieving data from web (From: Ibrahim Bulut <email@hidden>)
 >Re: NSMutableDictionary and retirieving data from web (From: Larry Fransson <email@hidden>)
 >Re: NSMutableDictionary and retirieving data from web (From: Ibrahim Bulut <email@hidden>)
 >Re: NSMutableDictionary and retirieving data from web (From: Ibrahim Bulut <email@hidden>)
 >Re: NSMutableDictionary and retirieving data from web (From: "Louis C. Sacha" <email@hidden>)

  • Prev by Date: Re: New book on its way!!!
  • Next by Date: Re: [OT] Mamasam Archives ...
  • Previous by thread: Re: NSMutableDictionary and retirieving data from web
  • Next by thread: Coco with java resources?
  • Index(es):
    • Date
    • Thread