Saturday, March 10, 2007

A Small Start on SHA1 Performance Part III

Since we first wrote SHA1 (years ago), it looks like rotate is now in Data.Bits so we can use that rather than rolling our own.

type Rotation = Int

rotL :: Rotation -> Word32 -> Word32
rotL s a = shiftL a s .|. shiftL a (s-32)

rotL' = flip rotateL


This saves some more time.


Sat Mar 10 14:28 2007 Time and Allocation Profiling Report (Final)

perfTest +RTS -p -RTS eg

total time = 7.15 secs (143 ticks @ 50 ms)
total alloc = 1,484,351,328 bytes (excludes profiling overheads)

COST CENTRE MODULE %time %alloc

oneBlock Data.Digest.SHA1 35.7 40.1
$& Data.Digest.SHA1 16.1 21.6
f' Data.Digest.SHA1 10.5 6.1
test2 Main 8.4 8.7
getWord32s' Data.Digest.SHA1 7.7 6.6
blockWord8sIn512 Data.Digest.SHA1 5.6 4.4
k' Data.Digest.SHA1 4.9 0.0
blockWord8sIn32 Data.Digest.SHA1 4.9 5.3
pad Data.Digest.SHA1 3.5 3.5
fromBytes Data.Digest.SHA1 2.1 3.5

No comments: