Created
June 18, 2014 18:36
-
-
Save apokalyptik/7c3a931452c8f07cdee7 to your computer and use it in GitHub Desktop.
Patricia VS Quicktrie
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"log" | |
"net/http" | |
_ "net/http/pprof" | |
"github.com/apokalyptik/quicktrie" | |
"gopkg.in/tchap/go-patricia.v1/patricia" | |
) | |
func main() { | |
go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }() | |
pt := patricia.NewTrie() | |
qkv := trie.NewKVTrie() | |
qbw := trie.NewBWTrie() | |
for i := 0; i < 1000000; i++ { | |
b := make([]byte, 25) | |
rand.Read(b) | |
pt.Insert(b, struct{}{}) | |
qkv.Add(b, struct{}{}) | |
qbw.Add(b) | |
} | |
log.Printf("ready") | |
var wait = make(chan struct{}) | |
<-wait | |
} |
Author
apokalyptik
commented
Jun 18, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment