Skip to content

Commit

Permalink
remove unnecessary dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
edwingeng committed May 29, 2022
1 parent c82f1bc commit a7ddc06
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 65 deletions.
44 changes: 0 additions & 44 deletions benchmark/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ package benchmark

import (
"fmt"
"stathat.com/c/consistent"
"strconv"
"testing"

"github.com/edwingeng/doublejump"
"github.com/serialx/hashring"
)

var (
Expand All @@ -31,44 +28,3 @@ func BenchmarkDoubleJump(b *testing.B) {
})
}
}

func BenchmarkStathatConsistent(b *testing.B) {
for i := 10; i <= 1000; i *= 10 {
b.Run(fmt.Sprintf("%d-nodes", i), func(b *testing.B) {
h := consistent.New()
for j := 0; j < i; j++ {
h.Add(fmt.Sprintf("node%d", j))
}
a := make([]string, b.N)
for j := 0; j < b.N; j++ {
a[j] = strconv.Itoa(j)
}

b.ResetTimer()
for j := 0; j < b.N; j++ {
g.Ret, _ = h.Get(a[j])
}
})
}
}

func BenchmarkSerialxHashring(b *testing.B) {
for i := 10; i <= 1000; i *= 10 {
b.Run(fmt.Sprintf("%d-nodes", i), func(b *testing.B) {
nodes := make([]string, i)
for j := 0; j < i; j++ {
nodes[j] = fmt.Sprintf("node%d", j)
}
h := hashring.New(nodes)
a := make([]string, b.N)
for j := 0; j < b.N; j++ {
a[j] = strconv.Itoa(j)
}

b.ResetTimer()
for j := 0; j < b.N; j++ {
g.Ret, _ = h.GetNode(a[j])
}
})
}
}
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
module github.com/edwingeng/doublejump

require (
github.com/dgryski/go-jump v0.0.0-20170409065014-e1f439676b57
github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b
github.com/stretchr/testify v1.7.0 // indirect
stathat.com/c/consistent v1.0.1-0.20190920041245-30ea17e8a481
)
require github.com/dgryski/go-jump v0.0.0-20170409065014-e1f439676b57

go 1.13
15 changes: 0 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-jump v0.0.0-20170409065014-e1f439676b57 h1:qZNIK8jjHgLFHAW2wzCWPEv0ZIgcBhU7X3oDt/p3Sv0=
github.com/dgryski/go-jump v0.0.0-20170409065014-e1f439676b57/go.mod h1:4hKCXuwrJoYvHZxJ86+bRVTOMyJ0Ej+RqfSm8mHi6KA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b h1:h+3JX2VoWTFuyQEo87pStk/a99dzIO1mM9KxIyLPGTU=
github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b/go.mod h1:/yeG0My1xr/u+HZrFQ1tOQQQQrOawfyMUH13ai5brBc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
stathat.com/c/consistent v1.0.1-0.20190920041245-30ea17e8a481 h1:UjjiGI6ZziCLY/t/x/DbrPG2Bw3nXqgpf+sxQeIf1Fg=
stathat.com/c/consistent v1.0.1-0.20190920041245-30ea17e8a481/go.mod h1:QkzMWzcbB+yQBL2AttO6sgsQS/JSTapcDISJalmCDS0=

0 comments on commit a7ddc06

Please sign in to comment.