• 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: are static operations optimized?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: are static operations optimized?


  • Subject: Re: are static operations optimized?
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Tue, 27 Jan 2009 17:43:59 +0100


Le 27 janv. 09 à 17:32, David Harper a écrit :

Hello,

Though perhaps it is irrelevant to fuss about O(1) operations, I was wondering if anyone with some familiarity with the objective-C compiler could say whether static operations are actually calculated at runtime or parsed & pre-calculated for optimization purposes. When I say static operations I refer to those without variables.

For example, if I had a method with the following return statement:

return (128 - 6);

would this be compiled as "return 122" ? Would pre-calculating such things save a relevant amount of clock cycles if such a statement were evaluated, say, 100,000 times per second?

Just curious. I apologize if this is the incorrect list for such a question.


Yes, this kind of expression is an "integer constant expression" and must (or should, I don't remember) be evaluated at compile time according to the C standard.




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


References: 
 >are static operations optimized? (From: David Harper <email@hidden>)

  • Prev by Date: are static operations optimized?
  • Next by Date: Re: are static operations optimized?
  • Previous by thread: are static operations optimized?
  • Next by thread: Re: are static operations optimized?
  • Index(es):
    • Date
    • Thread