It isn't the start-up time. It is probably an effect of the working set "settling in" or any number of other things that can affect benchmark numbers. In general, a 5% or less difference isn't something I would consider "real" as running it an hour later could certainly swing the answer that much. Here is the code I used:
use Benchmark qw(cmpthese);
my $str= "This is a test, " x 200;
my $single= "'".$str."'";
my $double= '"'.$str.'"';
cmpthese( -3, {
a_double => sub { eval $double },
b_single => sub { eval $single },
c_double => sub { eval $double },
d_single => sub { eval $single },
} );
I don't have my original results (20% difference), but a re-run gave this:
Rate a_double c_double b_single d_single
a_double 4773/s -- -1% -23% -23%
c_double 4830/s 1% -- -22% -22%
b_single 6170/s 29% 28% -- -0%
d_single 6172/s 29% 28% 0% --
-
tye
(but my friends call me "Tye")
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|