Re: Split line into an array vs multiple strings
- From: "scottmf" <fleming.scott@xxxxxxxxx>
- Date: 27 Jul 2005 17:23:47 -0700
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% --
.
- References:
- Split line into an array vs multiple strings
- From: scottmf
- Re: Split line into an array vs multiple strings
- From: John W. Krahn
- Split line into an array vs multiple strings
- Prev by Date: Re: Perl performance issue
- Next by Date: Re: Read first few lines from command output
- Previous by thread: Re: Split line into an array vs multiple strings
- Next by thread: Interested in saving money on your outsourcing?
- Index(es):
Relevant Pages
|
|