in reply to how can I speed this up?
Alba_1 is almost exactly TheoPetersen's solution (I didn't bother posting after seeing his)
Alba_2 is a variant that does the unpacking this way:
rbi_fortran is rbi's code (though made strict compliant). And the result are (based on 7 fields in $record):my @fractions = unpack('A5'x$nt, substr($record, 0, 5*$nt)); my @exps = unpack('A2'x$nt, substr($record, 5*$nt, 2*$nt));
So what gives? I could have sworn unpack was faster. One thing I tried is the effect of the number of fields to extract, so here it is with 28 fields in $record:Benchmark: running Alba_1, Alba_2, rbi_fortran, each for at least 5 CP +U seconds... Alba_1: 6 wallclock secs ( 5.31 usr + 0.00 sys = 5.31 CPU) @ 39 +94.16/s (n=21217) Alba_2: 6 wallclock secs ( 5.41 usr + 0.00 sys = 5.41 CPU) @ 47 +89.68/s (n=25893) rbi_fortran: 5 wallclock secs ( 5.26 usr + 0.00 sys = 5.26 CPU) @ 5 +211.78/s (n=28266)
Basically no effect. Any other ideas?Benchmark: running Alba_1, Alba_2, rbi_fortran, each for at least 5 CP +U seconds... Alba_1: 5 wallclock secs ( 5.39 usr + 0.00 sys = 5.39 CPU) @ 12 +14.06/s (n=6545) Alba_2: 6 wallclock secs ( 5.41 usr + 0.00 sys = 5.41 CPU) @ 14 +25.64/s (n=7707) rbi_fortran: 5 wallclock secs ( 5.37 usr + 0.00 sys = 5.37 CPU) @ 1 +540.09/s (n=8278)
--
I'd like to be able to assign to an luser
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: how can I speed this up?
by rbi (Monk) on Feb 24, 2001 at 03:00 UTC |