]> Cypherpunks repositories - gostls13.git/commit
exp/html/atom: faster Lookup with smaller tables
authorRuss Cox <rsc@golang.org>
Sun, 3 Jun 2012 02:43:11 +0000 (22:43 -0400)
committerRuss Cox <rsc@golang.org>
Sun, 3 Jun 2012 02:43:11 +0000 (22:43 -0400)
commit192550592a24a8ba1e826d11f0426e5889c1a0af
tree30827aa5084af45ce3412e1b24da9e98faf2cf4c
parent911f802b37dec543caf7646fdc8987d4be299c5c
exp/html/atom: faster Lookup with smaller tables

Use perfect cuckoo hash, to avoid binary search.
Define Atom bits as offset+len in long string instead
of enumeration, to avoid string headers.

Before: 1909 string bytes + 6060 tables = 7969 total data
After: 1406 string bytes + 2048 tables = 3454 total data

benchmark          old ns/op    new ns/op    delta
BenchmarkLookup        83878        64681  -22.89%

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/6262051
src/pkg/exp/html/atom/atom.go
src/pkg/exp/html/atom/atom_test.go
src/pkg/exp/html/atom/gen.go
src/pkg/exp/html/atom/table.go
src/pkg/exp/html/atom/table_test.go [new file with mode: 0644]