Re: Beginner Projects
- From: Lew <lew@xxxxxxxxxxxxx>
- Date: Thu, 30 Aug 2007 09:26:33 -0400
Roedy Green wrote:
It is simpler code, so I don't count it as optimisation. Optimisation
that gets you in trouble is verbose, harder-to-maintain code. I
figure every student should be familiar with odd/even idiom.
Joshua Cranmer wrote:
Sometimes it can save you.
int mid = (low + high) / 2;
int mid = (low + high) >>> 1;
The first one breaks when low + high > 2^31-1, the second one doesn't (only when low + high > 2^32 - 1).
In other news, premature optimization only counts IMO when the change involves non-trivial optimizations.
You guys are absolutely right.
--
Lew
.
- References:
- Beginner Projects
- From: Pseudo Silk Kimono
- Re: Beginner Projects
- From: Roedy Green
- Re: Beginner Projects
- From: Lew
- Re: Beginner Projects
- From: Roedy Green
- Re: Beginner Projects
- From: Joshua Cranmer
- Beginner Projects
- Prev by Date: Re: Beginner Projects
- Next by Date: Re: Beginner Projects
- Previous by thread: Re: Beginner Projects
- Next by thread: Re: Beginner Projects
- Index(es):