Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
G'day team,
Thanks for this really cool project.
I was wondering about performance, so I started writing a little benchmark and thought maybe others would benefit also.
This isn't great, and I'm sure you can do better, but at least it's something.
das@das-dell5580:~/go/src/github.com/randomizedcoder/go-iptree/iptree$ go test -bench=.
benchmarkLookup maxIP: 30 lookups: 1000
ip trie loaded with: 707281
goos: linux
goarch: amd64
pkg: github.com/zmap/go-iptree/iptree
BenchmarkLookupA-4 benchmarkLookup maxIP: 30 lookups: 1000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000
ip trie loaded with: 707281
1000000000 0.000780 ns/op
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
BenchmarkLookupB-4 benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
benchmarkLookup maxIP: 30 lookups: 1000000
ip trie loaded with: 707281
268 4746592 ns/op
benchmarkLookup maxIP: 30 lookups: 10000000
ip trie loaded with: 707281
BenchmarkLookupC-4 1 10437866110 ns/op
PASS
ok github.com/zmap/go-iptree/iptree 47.608s