Ken Yap wrote:
>
> >> 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.
>
> I should add that the 0.1s included the time to read in the file and
> mknbi has to do this anyway.
>
> >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.
>
> I don't see any other reasonable way to do it. You're only calling it as
> many times as there are 64k chunks so it's not a significant overhead I
> think.
Eric,
Based on Ken's comments about needing to load the file in anyway, it occurs
to me that maybe you could integrate the checksum code with the code that
loads the file in. If you read in the file in 64K chunks, you could checksum
each chunk. If you do this, benchmark it against the current version and dump
it if it isn't substantially faster (and maybe dump it anyway in the interest
of readability if it only takes 0.1s).
It has been a long while since I looked at mknbi, so this idea might not
come anywhere close to useful. But since I had it, I thought I would
share it. :^)
-Don
--
Don Christensen Senior Software Development Engineer
dj...@ci... Cisco Systems, Santa Cruz, CA
"It was a new day yesterday, but it's an old day now."
|