• 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: Need help building an EOQualifier with session values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help building an EOQualifier with session values


  • Subject: Re: Need help building an EOQualifier with session values
  • From: Mike Schrag <email@hidden>
  • Date: Mon, 22 May 2006 15:51:59 -0400

Technically speaking, you can ALWAYS use valueForKeyPath and it will work. Obviously valueForKey does not have that attribute.

So the question is performance ... I've kind of wondered this before also. So in the spirit of knowing-is-half-the-battle:

I have an object with one method "public String getName()" and ran one million iterations of the following:

NSKeyValueCoding.Utility.valueForKey "name": 935ms
NSKeyValueCodingAdditions.Utility.valueForKeyPath "name": 992ms
NSKeyValueCodingAdditions.Utility.valueForKeyPath "name.length": 2713ms

That's total time for all 1 million. So basically no diff using keypath vs key -- i would say always use it. I included the next one just because it was kind of interesting. Obviously there aren't enough examples to know if that's a function of the performance of .length() on String or whether traversing multiple keypaths is nasty.

On May 22, 2006, at 3:33 PM, Zak Burke wrote:

Chuck Hill wrote on 5/21/06 11:44 AM:
    NSArray bindings = new NSArray( new Object [] {
(Session)session().valueForKey("user.client.clientName") } );

valueForKeyPath not valueForKey

I've been bitten by this one too.

Is there ever a reason to use valueForKey instead of valueForKeyPath? (I
ask this question along the same vein as, "Is the simplicity of always
using addObjectToBothSidesOfRelationshipWithKey worth the potential
performance hit compared to addObjectToPropertyWithKey?")


The NSKeyValueCodingAdditions documentation doesn't allude to any
performance hits, and says its basically implemented in terms of value
for key. Is valueForKey faster? I supposed it would be because it won't
even try to access items along the keypath; it'll just die right away.


As an aside, is it possible for an item to have a valid key containing a
dot? Don't keys eventually map to object properties that have to conform
to java variable names?


zak.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Need help building an EOQualifier with session values
      • From: "Jerry W. Walker" <email@hidden>
    • Re: Need help building an EOQualifier with session values
      • From: Wolfram Stebel <email@hidden>
References: 
 >Need help building an EOQualifier with session values (From: Reid Bundonis <email@hidden>)
 >Re: Need help building an EOQualifier with session values (From: Chuck Hill <email@hidden>)
 >Re: Need help building an EOQualifier with session values (From: Zak Burke <email@hidden>)

  • Prev by Date: Re: Need help building an EOQualifier with session values
  • Next by Date: Re: Need help building an EOQualifier with session values
  • Previous by thread: Re: Need help building an EOQualifier with session values
  • Next by thread: Re: Need help building an EOQualifier with session values
  • Index(es):
    • Date
    • Thread