• 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: Performance, Efficiency - Coding practice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance, Efficiency - Coding practice


  • Subject: Re: Performance, Efficiency - Coding practice
  • From: Andrew Farmer <email@hidden>
  • Date: Thu, 28 May 2009 17:24:34 -0700

On 28 May 2009, at 16:57, John Ku wrote:
<snip>
Is this a more efficient way to code? Which coding practice is better in
terms of efficiency, memory, performance?
The update method will get called often. So Im thinking there is no need to
create 'NSPoint drawAtOrigin' everytime.
Your thoughts?

NSPoint is a structure, not an object, so creating it is practically free - there is literally no measurable difference in performance between the two approaches.


However, you have an unrelated but serious problem in your original class:

NSString *title = [[NSString alloc] init];
title = @"TEST";

This leaks a NSString object. Also, it's almost never correct to call NSString's init method, as the object created is immutable.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Performance, Efficiency - Coding practice (From: John Ku <email@hidden>)

  • Prev by Date: Re: Performance, Efficiency - Coding practice
  • Next by Date: Re: performSelectorOnMainThread problem
  • Previous by thread: Re: Performance, Efficiency - Coding practice
  • Next by thread: Re: Performance, Efficiency - Coding practice
  • Index(es):
    • Date
    • Thread