in reply to Re^2: Display shortened paragraph
in thread Display shortened paragraph
I agree that premature optimization is an evil thing. Having some knowledge about the relative merits of different approaches to solving a problem is an essential part of providing a good solution. Execution efficiency is one parameter that should be considered when evaluating different approaches.
That is not to say that you should "benchmark early and often". In fact, generally you don't need to benchmark at all in the normal course of writing code (in any language). However at PerlMonks we are in a special situation where all facits of a piece of code come under scrutiny for the edification of the monks.
I say, in the context of PerlMonks, where many different approaches to solving a problem are suggested, that benchmarking should be done "early and often". In this particular case there are in essence three different approaches suggested with wildly different execution speeds. The benchmark should strongly convey that dealing retail with characters is SLOW (jbrug2) and that narrow purpose functions (substr, rindex) are faster than general purpose functions (regex). That is a valuable lesson in any book!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Display shortened paragraph
by blazar (Canon) on Feb 02, 2006 at 10:00 UTC | |
by GrandFather (Saint) on Feb 02, 2006 at 20:24 UTC | |
by blazar (Canon) on Feb 03, 2006 at 11:05 UTC |