Re: Split line into an array vs multiple strings



I ran some more tests starting with an input file of 10000 lines, and
increasing the filesize by 10000 lines for each benchmark, and I get
the following.
At this rate if my input file had 80000 lines it would take the string
method almost 30 times longer than the array method to just grab the
data. Also does anyone know why in the benchmark comparison the first
column changes from iterations per second to seconds per iteration?

Benchmark: timing 10 iterations of array_test, string_test...
array_test: 2 wallclock secs ( 2.09 usr + 0.02 sys = 2.11 CPU) @
4.74/s (n=10)
string_test: 6 wallclock secs ( 5.17 usr + 0.01 sys = 5.19 CPU) @
1.93/s (n=10)
Rate string_test array_test
string_test 1.93/s -- -59%
array_test 4.74/s 146% --
Benchmark: timing 10 iterations of array_test, string_test...
array_test: 4 wallclock secs ( 4.20 usr + 0.03 sys = 4.23 CPU) @
2.36/s (n=10)
string_test: 17 wallclock secs (16.52 usr + 0.02 sys = 16.53 CPU) @
0.60/s (n=10)
s/iter string_test array_test
string_test 1.65 -- -74%
array_test 0.423 290% --
Benchmark: timing 10 iterations of array_test, string_test...
array_test: 6 wallclock secs ( 6.31 usr + 0.02 sys = 6.33 CPU) @
1.58/s (n=10)
string_test: 39 wallclock secs (39.33 usr + 0.11 sys = 39.44 CPU) @
0.25/s (n=10)
s/iter string_test array_test
string_test 3.94 -- -84%
array_test 0.633 523% --
Benchmark: timing 10 iterations of array_test, string_test...
array_test: 8 wallclock secs ( 8.39 usr + 0.03 sys = 8.42 CPU) @
1.19/s (n=10)
string_test: 84 wallclock secs (83.25 usr + 0.05 sys = 83.30 CPU) @
0.12/s (n=10)
s/iter string_test array_test
string_test 8.33 -- -90%
array_test 0.842 889% --

.



Relevant Pages

  • Re: Slow -f test on Windows in recent Perl-versions
    ... I upgraded from Perl version 5.005_03 to version v5.8.7 (an ActiveState ... Benchmark: timing 100 iterations of filetest... ...
    (comp.lang.perl.moderated)
  • Re: How to find regex at specific location on line
    ... benchmark complained about too few iterations. ... use Benchmark qw(:hireswallclock cmpthese timethese); ... timing 10000000 iterations of plain_regex, plain_substr, ...
    (perl.beginners)
  • Re: Replacement Help
    ... > Mark Clements wrote: ... > Benchmark: timing 100000 iterations of Clements... ...
    (comp.lang.perl.misc)
  • Re: Replacement Help
    ... Mark Clements wrote: ... Benchmark: timing 100000 iterations of Clements... ...
    (comp.lang.perl.misc)
  • Re: Replacement Help
    ... Benchmark: timing 100000 iterations of PurlGurl... ... Prev by Date: ...
    (comp.lang.perl.misc)