Skip to content

Commit 68dcb67

Browse files
committed
chore: docs
1 parent 7a39184 commit 68dcb67

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,3 @@ On the first try, this yielded the following result:
120120
```
121121

122122
That's really sick considering that _no_ effort was put into manually creating a new JSON struct, and the original struct didn't have any JSONSchema tags - just JSON serdes comments.
123-
124-
###

bench.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
```
3+
goos: linux
4+
goarch: amd64
5+
pkg: github.com/stillmatic/gollum
6+
cpu: AMD Ryzen 9 7950X 16-Core Processor
7+
BenchmarkMemoryVectorStore/BenchmarkInsert-n=10-32 14752 83971 ns/op 64912 B/op 10 allocs/op
8+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=10-k=1-32 810657 1256 ns/op 288 B/op 3 allocs/op
9+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=10-k=10-32 663574 1639 ns/op 2880 B/op 6 allocs/op
10+
BenchmarkMemoryVectorStore/BenchmarkInsert-n=100-32 1263 1042804 ns/op 646807 B/op 190 allocs/op
11+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=100-k=1-32 113851 10399 ns/op 288 B/op 3 allocs/op
12+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=100-k=10-32 93428 12625 ns/op 2880 B/op 6 allocs/op
13+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=100-k=100-32 69256 17569 ns/op 25664 B/op 9 allocs/op
14+
BenchmarkMemoryVectorStore/BenchmarkInsert-n=1000-32 147 8100071 ns/op 6505065 B/op 2734 allocs/op
15+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=1000-k=1-32 10000 104921 ns/op 288 B/op 3 allocs/op
16+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=1000-k=10-32 9831 123464 ns/op 2880 B/op 6 allocs/op
17+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=1000-k=100-32 7848 152007 ns/op 25664 B/op 9 allocs/op
18+
BenchmarkMemoryVectorStore/BenchmarkInsert-n=10000-32 13 82907557 ns/op 64727761 B/op 29740 allocs/op
19+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=10000-k=1-32 783 1514925 ns/op 288 B/op 3 allocs/op
20+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=10000-k=10-32 679 1692251 ns/op 2880 B/op 6 allocs/op
21+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=10000-k=100-32 650 2095042 ns/op 25664 B/op 9 allocs/op
22+
BenchmarkMemoryVectorStore/BenchmarkInsert-n=100000-32 2 814309670 ns/op 648192728 B/op 299774 allocs/op
23+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=100000-k=1-32 82 16656264 ns/op 288 B/op 3 allocs/op
24+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=100000-k=10-32 68 16402470 ns/op 2880 B/op 6 allocs/op
25+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=100000-k=100-32 64 18205266 ns/op 25664 B/op 9 allocs/op
26+
BenchmarkMemoryVectorStore/BenchmarkInsert-n=1000000-32 1 9578485965 ns/op 6552089784 B/op 2999874 allocs/op
27+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=1000000-k=1-32 7 161260588 ns/op 288 B/op 3 allocs/op
28+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=1000000-k=10-32 7 212760511 ns/op 2880 B/op 6 allocs/op
29+
BenchmarkMemoryVectorStore/BenchmarkQuery-n=1000000-k=100-32 4 290261365 ns/op 25664 B/op 9 allocs/op
30+
PASS
31+
ok github.com/stillmatic/gollum 111.224s
32+
```

vectorstore_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ func BenchmarkMemoryVectorStore(b *testing.B) {
145145
nValues := []int{10, 100, 1_000, 10_000, 100_000, 1_000_000}
146146
kValues := []int{1, 10, 100}
147147
for _, n := range nValues {
148+
b.Run(fmt.Sprintf("BenchmarkInsert-n=%v", n), func(b *testing.B) {
149+
mvs := gollum.NewMemoryVectorStore(llm)
150+
for i := 0; i < b.N; i++ {
151+
for j := 0; j < n; j++ {
152+
mv := gollum.Document{
153+
ID: fmt.Sprintf("%v", j),
154+
Content: "test",
155+
Embedding: getRandomEmbedding(1536),
156+
}
157+
mvs.Insert(ctx, mv)
158+
}
159+
}
160+
})
148161
for _, k := range kValues {
149162
if k <= n {
150163
b.Run(fmt.Sprintf("BenchmarkQuery-n=%v-k=%v", n, k), func(b *testing.B) {

0 commit comments

Comments
 (0)