Skip to content

Commit f1bef4b

Browse files
committed
Add benchmark
1 parent 7c96e7c commit f1bef4b

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func Example() {
1111
// at a false-positives rate less than 0.5 percent.
1212
blacklist := bloom.New(10000, 200)
1313

14-
// Add a string to the filter.
14+
// Add an element to the filter.
1515
url := "https://rascal.com"
1616
blacklist.Add(url)
1717

filter_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ func TestFilter(t *testing.T) {
5757
}
5858
}
5959
}
60+
61+
func BenchmarkAdd(b *testing.B) {
62+
filter := New(10000, 200)
63+
for i := 0; i < b.N; i++ {
64+
filter.Add("The quick brown fox jumps over the lazy dog.")
65+
}
66+
}

0 commit comments

Comments
 (0)