• 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: Core Data: undo and non-object attribute [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: undo and non-object attribute [SOLVED]


  • Subject: Re: Core Data: undo and non-object attribute [SOLVED]
  • From: Jakob Olesen <email@hidden>
  • Date: Sun, 15 Oct 2006 19:43:52 +0200


On 15/10/2006, at 19.09, Matteo Rossi wrote:

I'll try to explain. My drawing application needs to handle many graphic objects (say 10.000). Since I'm using OpenGL and find myself refreshing the drawing view many times per second during panning and zooming I want to store object coordinates in ivars because I suspect that using valueForKey: would be a total waste of time. Yes I know CD is "highly optimized and continuously improved to be efficient" but it still requires much more time than the good old way. Am I wrong ? By keeping x and y in a struct I can pass them as a double pointer to opengl functions. I must be sincere: I haven't tested performances in both cases. It's just an assumption, by now. Thank you again.

As always with performance issues, you really should measure before deciding.


Remember, you still must call -willAccessValueForKey: and - didAccessValueForKey: before using your instance variables directly.

I would be very interested to hear if you are able to measure a performance difference between the plain

XSAPPoint p;
p.x = [[self valueForKey:@"x"] doubleValue];
p.y = [[self valueForKey:@"y"] doubleValue];

and your

[self willAccessValueForKey:@"x"];
[self willAccessValueForKey:@"y"];
// use _point
[self didAccessValueForKey:@"x"];
[self didAccessValueForKey:@"y"];

Another option would be to use two instance variables named x and y. They would be part of "the guts", but you don't have to write your primitiveX accessors.

Please post your measurements, if you make them.


_______________________________________________ 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: Core Data: undo and non-object attribute [SOLVED]
      • From: Matteo Rossi <email@hidden>
References: 
 >Core Data: undo and non-object attribute (From: Matteo Rossi <email@hidden>)
 >Re: Core Data: undo and non-object attribute (From: Jakob Olesen <email@hidden>)
 >Re: Core Data: undo and non-object attribute (From: Matteo Rossi <email@hidden>)
 >Re: Core Data: undo and non-object attribute (From: Jakob Olesen <email@hidden>)
 >Re: Core Data: undo and non-object attribute [SOLVED] (From: Matteo Rossi <email@hidden>)

  • Prev by Date: Re: Re: NSImage drawAtPoint & Transparency
  • Next by Date: How to forward mouse events to another view?
  • Previous by thread: Re: Core Data: undo and non-object attribute [SOLVED]
  • Next by thread: Re: Core Data: undo and non-object attribute [SOLVED]
  • Index(es):
    • Date
    • Thread