Skip to content

Commit

Permalink
becnhmark
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelightning committed Jun 19, 2024
1 parent 4226ba4 commit 2a927cd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,26 @@ func generateDataset(size int) []string {
return dataset
}

func BenchmarkTestARTree_InsertAndSearchWords(b *testing.B) {

art := NewRadixTree[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)
}

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

func BenchmarkMixedOperations(b *testing.B) {
dataset := generateDataset(datasetSize)
art := NewRadixTree[int]()
Expand Down

0 comments on commit 2a927cd

Please sign in to comment.