in reply to Improving performance of checksum calculation
You should be using binmode on your input handle.
($check_value & 0x7fffffff) << 1
might be safer (more portable) than
($check_value << 1) & 0xffffffff
The following is faster (but nowhere near as fast as C would be):
$check_value ^= unpack('L', $_); $check_value = ( ($check_value & 0x7fffffff) << 1 ) | ( $check_value >> 31 );
Using C doesn't require shelling out. perlxstut or Inline::C will allow you to access C code from perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Improving performance of checksum calculation
by Crackers2 (Parson) on May 30, 2009 at 16:15 UTC |