• 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: ADC Core Data article
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ADC Core Data article


  • Subject: Re: ADC Core Data article
  • From: Charlton Wilbur <email@hidden>
  • Date: Thu, 7 Apr 2005 09:11:54 -0400


On Apr 7, 2005, at 5:59 AM, Marcel Weiher wrote:

Sure does!

    result = [employee valueForKey:@"name"];
vs.
    result = [employee name];

The second is:

1. Expressed directly in the target language (Occam's Razor, anyone?)
2. More compact
3. Easier to read
4. About an order of magnitude faster ( about 8 times, to be a bit more precise )


An order of magnitude here, an order of magnitude there, and soon enough you're talking about real performance pigs...

If you wrote everything in C instead of Objective-C, you'd lose all the overhead of method dispatch. How much longer does it take to dispatch a method call instead of just calling a function? If you wrote the whole thing in one long continuous stream of PowerPC assembly, it would be still faster, because you could hand-optimize the assembly and get it to run REALLY quickly! Of course, this is not a sign that either is better -- programmers get significant benefits from using C instead of assembly, and from using Objective-C instead of C, and from using bindings instead of straight method calls.


In the case of bindings (as well as in the two examples I gave), bindings are not a pure *replacement* for method calls, they're an *alternative* to it that makes some things a lot easier at the cost of performance. They're not meant to be a replacement for routine accessor functions (though you can certainly use them for that!) but as a way of doing a particular sort of introspection that happens to be very useful for writing generic UI classes. The cases you'd use bindings in are *not* the cases where a simple accessor would be appropriate; they're the cases where using bindings instead of simple accessors allows one to eliminate 10 lines of code here, 10 lines of code there.

All you've really managed to demonstrate is that bindings do not make a good replacement for simple accessor calls. We knew that already.

Charlton




-- Charlton Wilbur email@hidden email@hidden email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: ADC Core Data article
      • From: Marcel Weiher <email@hidden>
    • Re: ADC Core Data article
      • From: Mike Ferris <email@hidden>
References: 
 >ADC Core Data article (From: mmalcolm crawford <email@hidden>)
 >Re: ADC Core Data article (From: Philip Mötteli <email@hidden>)
 >Re: ADC Core Data article (From: "Timothy Reaves" <email@hidden>)
 >Re: ADC Core Data article (From: Scott Stevenson <email@hidden>)
 >Re: ADC Core Data article (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Application Icon Blues
  • Next by Date: *Help* with mysterious crash... CFRetain related
  • Previous by thread: Re: ADC Core Data article
  • Next by thread: Re: ADC Core Data article
  • Index(es):
    • Date
    • Thread