in reply to fast way to split and sum an input file
[^,] is slightly (8%) faster than \d, and don't forget to comment out print STDERR "Working on: ..." from the Perl version since you don't the equivalent in the C code.
It's not surprising that Perl is slower. It's no secret. While Perl's speed is decent, it's not its strong point. One strong point is the speed at which programs are written in Perl. For example, it took no time at all to write the following Perl solution to your problem:
perl -ne "END { print(qq{Total: $t\n}); } $t += (split ',')[99]" file
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fast way to split and sum an input file
by davidrw (Prior) on Aug 29, 2005 at 21:11 UTC |