Steve Bertrand wrote:
Given the following lines:

$MESSAGE .= "<P>Application Fee: <B>" . $price . " Dollars U.S.</B>";

$MESSAGE .= "<P>Application Fee: <B>$price Dollars U.S.</B>";

In that case it seems a bit pointless to do the first way as there are now 3 things instead of 1 to deal with. the Benchmark module will help a lot :)


Is there a performance issue (or any other issue) for using either of
the above lines?  Does it make any difference which is used?

Suppose it changed to the following:

$MESSAGE .= "<P>Application Fee: <B>" . $query-param('price') . "
Dollars U.S.</B>";

or

$MESSAGE .= "<P>Application Fee: <B>$query-param('price') Dollars
U.S.</B>";

You mean: $query->param('price') right? :)

if you're doing something like that or a function thats a good way to do it but don't if you don't need to.
benchmark will tell you how they compare.


I have used the first two lines without any noticeable difference, but
I
didn't use any sort of debugging/timer tools either.  I am debating
with
myself about which line from the second set I should use.  In all
instances the correct value of "price" was inserted into the variable
$MESSAGE

Here's a benchmark I did:

Benchmark: timing 2000000 iterations of all one, with dots...
all one: 0.839485 wallclock secs ( 0.78 usr + 0.00 sys = 0.78 CPU) @ 2564102.56/s (n=2000000)
with dots: 0.975471 wallclock secs ( 1.01 usr + -0.01 sys = 1.00 CPU) @ 2000000.00/s (n=2000000)
Rate with dots all one
with dots 2000000/s -- -22%
all one 2564103/s 28% --


HTH :)

Lee.M - JupiterHost.Net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to