By the undef $/, the file is read in as a huge string.
Of course I checked, and with a n=1000 string I get:
Rate regex substr
regex 21775/s -- -27%
substr 29748/s 37% --
Which makes sense, as my file has some 50k chars.
Jeroen
"We are not alone"(FZ)
Update: (I'm not going to make a
Re:{9} post)
I'd say, start checking the source {grin}
$str='a'x1E6;
=>
Rate regex substr
regex 15.1/s -- -16%
substr 18.0/s 19% --
$str='a'x1E7;
=>
Rate regex substr
regex 1.41/s -- -21%
substr 1.79/s 27% --
At 100M, I'm testing my swap ;-)..... I tried it nevertheless, but now I'm waiting for my box
stop swapping... /me is afraid that may take a while... :-)...
finally, I had to use that reboot button :-<
25M still went OK:
s/iter regex substr
regex 1.80 -- -21%
substr 1.42 27% --
at 50M, benchmark produced a division by zero .....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.