Re: minimal (?) optimization (Was Re: String manipulation, optimize)



R. Rajesh Jeba Anbiah wrote:
Erwin Moller wrote:

Rune wrote:

<snip>

Why do you care about minimal optimalizations?

<snip>

  Sorry, I can't agree with you. In the world of optimization, there is
no minimal or maximal optimization--there is only onething, it's
optimization. Consider a situation/expression in which you can improve
the speed to 0.000001 second--and consider the same in 1000000 loop.
So, IMHO, definitely it is worth to optimize, even it is less than a
nano second thing.

--
  <?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com


Rajesh,

Sorry, this is an overly simplistic view. The IT industry generally recognizes several levels of optimization.

Optimization is always a trade off. It might be between development time vs. run time or a trade off between memory, disk space and runtime, for instance.

The problem is there are multiple ways to optimize. In the questioned case, minimal optimization might be to run samples of both and determine which is faster in this instance.

A higher level of optimization might be to run benchmarks on all the code to determine what is taking the longest time and looking for ways to improve code speed there. This would be important, for instance, if the server is becoming heavily loaded.

If the server is completely overloaded and something serious has to be done, the highest level of optimization would be to rewrite all the code in assembler. Of course, it would take the longest. But it would have the highest level of optimization possible for the user code.

Obviously there are other optimizations which may be made as well. For instance, RDB's. Fully normalized databases (5th normal) have the least amount of duplicate data - but are not the most efficient space wise, and definitely not performance-wise. Most databases are closer to 3rd normal form which is more efficient space wise than 2nd form normal, but less efficient in processing. Where performance is important, sometimes it's better to regress critical parts of the database to 2nd normal form for performance.

The above examples are just the tip of the iceberg. Optimization is not black and white, as you indicate. There are many, many levels of optimization involved.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.