Thank you, eyepopslikeamosquito. I reverted the failing optimization.
To be sure, I ran the improved test script against the following. All passing, including the two involving bit manipulations.
$ perl createblinker.pl 500000 -900000 100 >x.tmp 2>y.tmp
$ perl tbench1.pl x.tmp 2
mem size v5.26.0 v5.24.2 v5.22.4 cperl
infinite 7,548 MB 122 secs 119 secs 133 secs 116 secs
original 704 MB 167 secs 168 secs 180 secs 163 secs
improvements 744 MB 57 secs 57 secs 63 secs 54 secs
optimized i2 1,543 MB 38 secs 39 secs 40 secs 36 secs
2 nums into 1 1,510 MB 39 secs 40 secs 42 secs 37 secs
shorter impl 1,661 MB 40 secs 42 secs 44 secs 37 secs
It's been an interesting ride and learned a lot of things about Perl.
Regards, Mario
-
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.
|