ke...@us... (Ken Yap) writes:
> >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.
Nice. Then I won't worry about the code to much.
> >Does anyone have any objects to included this checksum ability
> >into mknbi?
>
> Go for it.
O.k. it is on my Todo/wishlist. So I will implement it the first
decent opportunity I get.
> >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.
Nice. Do you know if the substr hurts? I guess at 0.1s it isn't too
bad. Last time I was messing with the code and I complained checksums
in perl were terribly slow, you speculated that the problem was that I
was using substr. And it has taken me a long time to think of a
substitute.
Eric
|