Re: are static operations optimized?
Re: are static operations optimized?
- Subject: Re: are static operations optimized?
- From: Chris Williams <email@hidden>
- Date: Tue, 27 Jan 2009 08:59:23 -0800
- Thread-topic: are static operations optimized?
Title: Re: are static operations optimized?
Having spent years leading the team that created several of the more widely used compilers, I can assure you that no modern compiler would NOT do these optimizations. This kind of thing has been optimized since the mid 1980s.
On the broader front, many of the discussions I see on this list (and the Cocoa list) about various coding tricks to achieve performance are simply wasted effort. Virtually all good compilers perform optimizations far beyond your imagination, and many of these “tricks” are already handled or even worse they so badly confuse the optimizer as to make performance decline.
I share the opinion of most experts when I say: please spend your mental cycles on creating a solid data and code architecture and let the tools do what they do best. Every minute spent worrying about how to optimize an operation would be better spent figuring out an architecture that didn’t require the operation in the first place.
Chris
From: David Harper <email@hidden>
Reply-To: <email@hidden>
Date: Tue, 27 Jan 2009 08:32:28 -0800 (PST)
To: <email@hidden>
Subject: are static operations optimized?
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.
_______________________________________________
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
_______________________________________________
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