Skip to content

Commit

Permalink
add more benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelightning committed Aug 18, 2024
1 parent d8e0364 commit 5364c50
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions iradix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,31 @@ func BenchmarkTestARTree_InsertAndSearchWords(b *testing.B) {
art, _, _ = art.Insert([]byte(lines[i%(len(lines))]), 0)
}
}

func BenchmarkTestARTree_InsertAndSearchWords1(b *testing.B) {

art := New[int]()

file, _ := os.Open("test-text/words.txt")
defer file.Close()

scanner := bufio.NewScanner(file)
var lines []string
for scanner.Scan() {
line := scanner.Text()
lines = append(lines, line)
}

for _, line := range lines {
art, _, _ = art.Insert([]byte(line), 0)
}

b.ResetTimer()
for i := 1; i < b.N; i++ {
_, _ = art.Get([]byte(lines[i%(len(lines))]))
}
}

func TestRadix_HugeTxn(t *testing.T) {
r := New[int]()

Expand Down

0 comments on commit 5364c50

Please sign in to comment.