Re: [PHP] Performance: While or For loop
- From: robert@xxxxxxxxxxxxx (Robert Cummings)
- Date: Sat, 24 Mar 2007 14:24:18 -0400
On Sat, 2007-03-24 at 10:21 -0400, tedd wrote:
At 7:47 PM -0500 3/23/07, Richard Lynch wrote:
Folks:
How often do you use a loop of any kind in PHP with enough iterations
that this is even significant?
Write the code that makes sense.
Optimize the biggest bottleneck until performance is acceptable.
Absolutely -- the time we take discussing these types of concerns
probably cost more cycles than the sum total of all the "optimized"
savings in the lifetime of all the computers on earth.
I highly doubt it. Computers run a lot these days. There are times when
squeezing that last nanosecond makes a difference and the devotion to
finding how to squeeze it out is well worth it. Admittedly they may be
few and far between, but they do exist.
The time you spend trying to make something faster in those terms
clearly cost more time in development and maintenance. It's a
trade-off that's not worth it.
The time you spend can be large, but here we all know now how to speed
things up, if we just apply the principles that are easy to apply in all
the code we write, then such things will already be optimal and so in
hindsight we will already be reaping the rewards without any extra
effort.
Q: Do they teach this stuff in college now or are the teachers still
only measuring performance in myopic terms of saving memory and time?
Not a criticism, just a question.
They generally teach algorithmic analysis that improves the algorithm's
order of magnitude in contrast to teaching constant multiplicative
gains. However, that's not to say writing efficient code isn't a good
thing. If I have an algorithm that runs in X time, I'm sure if X is 2
years and I can shrink it to x/2 then nobody will quibble about the
constant gain since it happens to be 1 year of savings. Now depending on
the calculations you're doing, shaving off a nanosecond can indeed have
a large enough impact to make it worth your time.
Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
.
- Follow-Ups:
- Re: [PHP] Performance: While or For loop
- From: tedd
- Re: [PHP] Performance: While or For loop
- References:
- Performance: While or For loop
- From: "Tijnema !"
- Re: [PHP] Performance: While or For loop
- From: "Tijnema !"
- Re: [PHP] Performance: While or For loop
- From: "Tijnema !"
- Re: [PHP] Performance: While or For loop
- From: "Richard Lynch"
- Re: [PHP] Performance: While or For loop
- From: Unknown Sender
- Performance: While or For loop
- Prev by Date: Re: Book Suggestion for ZCE
- Next by Date: Re: [PHP] Performance: While or For loop
- Previous by thread: Re: [PHP] Performance: While or For loop
- Next by thread: Re: [PHP] Performance: While or For loop
- Index(es):
Relevant Pages
|