>Ken has all of the utilities in perl, and I have a one as well that
>prepare network bootable images. And for the longest time I could
>not figure out how to perl to do a reasonably fast job of computing
>the ip checksum. Reasonable as in under a minute. The attached
>code accomplishes that.
Your code runs in 0.1s on a 1MB vmlinuz file on my system (350MHz K6-2).
Congratulations.
>Does anyone have any objects to included this checksum ability
>into mknbi?
Go for it.
>Or ideas on how to speed of the ckecksum computation,
>even more?
You can get 20% improvement by using pass by reference. Call
compute_ip_checksum(\$string). In the routine, replace all but the first
$str with $$str.
|