I was looking for a rolling implementation of adler32, but I did not
find one with an interface I liked, so I wrote mine.

code: https://github.com/chmduquesne/rollinghash
doc: https://godoc.org/github.com/chmduquesne/rollinghash

To initialize the rolling window, just Write() it to the Hash. Then
you can just Roll() the entering byte to update the rolling hash. It
internally keeps (and updates) a copy of the rolling window in order
to determine the leaving byte.

I tested it with the same data as the vanilla package. The lib comes
with benchmarking code, to compare vanilla and rolling implementations
on 1024 and 128 bytes rolling windows:

  % go test -bench .
BenchmarkVanillaKB 100000 17974 ns/op 56.97 MB/s
BenchmarkRollingKB 20000000 80.6 ns/op 12705.49 MB/s
BenchmarkVanilla128B 1000000 1059 ns/op 966.14 MB/s
BenchmarkRolling128B 50000000 77.6 ns/op 13195.44 MB/s
ok github.com/chmduquesne/rollinghash/adler32 8.767s

If you like it, use it!

Christophe-Marie Duquesne

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 6 | next ›
Discussion Overview
groupgolang-nuts @
postedApr 21, '15 at 2:25p
activeApr 22, '15 at 9:52a



site design / logo © 2023 Grokbase