Skip to content

Commit 1e3525a

Browse files
committed
Update README
1 parent 5656523 commit 1e3525a

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

‎README.md‎

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ Because `chromem-go` is embeddable it enables you to add retrieval augmented gen
1111

1212
It's *not* a library to connect to Chroma and also not a reimplementation of it in Go. It's a database on its own.
1313

14-
The focus is not scale or number of features, but simplicity.
15-
16-
Performance has not been a priority yet. Without optimizations (except some parallelization with goroutines) querying 5,000 documents takes ~500ms on a mid-range laptop CPU (11th Gen Intel i5-1135G7, like in the first generation Framework Laptop 13).
14+
The focus is not scale (millions of documents) or number of features, but simplicity and performance for the most common use cases. On a mid-range 2020 Intel laptop CPU you can query 1,000 documents in 0.5 ms and 100,000 documents in 56 ms, both with just 44 memory allocations. See [Benchmarks](#benchmarks) for details.
1715

1816
> ⚠️ The project is in beta, under heavy construction, and may introduce breaking changes in releases before `v1.0.0`. All changes are documented in the [`CHANGELOG`](./CHANGELOG.md).
1917
@@ -23,8 +21,9 @@ Performance has not been a priority yet. Without optimizations (except some para
2321
2. [Interface](#interface)
2422
3. [Features](#features)
2523
4. [Usage](#usage)
26-
5. [Motivation](#motivation)
27-
6. [Related projects](#related-projects)
24+
5. [Benchmarks](#benchmarks)
25+
6. [Motivation](#motivation)
26+
7. [Related projects](#related-projects)
2827

2928
## Use cases
3029

@@ -156,8 +155,7 @@ See the Godoc for details: <https://pkg.go.dev/github.com/philippgille/chromem-g
156155
### Roadmap
157156

158157
- Performance:
159-
- [ ] Add Go benchmark code
160-
- [ ] Improve code based on CPU and memory profiles
158+
- [ ] Add SIMD / Assembler to speed up dot product calculation
161159
- Embedding creators:
162160
- [ ] Add an `EmbeddingFunc` that downloads and shells out to [llamafile](https://github.com/Mozilla-Ocho/llamafile)
163161
- Similarity search:
@@ -182,6 +180,28 @@ See the Godoc for a reference: <https://pkg.go.dev/github.com/philippgille/chrom
182180

183181
For full, working examples, using the vector database for retrieval augmented generation (RAG) and semantic search and using either OpenAI or locally running the embeddings model and LLM (in Ollama), see the [example code](examples).
184182

183+
## Benchmarks
184+
185+
```console
186+
$ go test -benchmem -run=^$ -bench .
187+
goos: linux
188+
goarch: amd64
189+
pkg: github.com/philippgille/chromem-go
190+
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
191+
BenchmarkCollection_Query_NoContent_100-8 10000 110126 ns/op 6492 B/op 44 allocs/op
192+
BenchmarkCollection_Query_NoContent_1000-8 2020 537416 ns/op 35669 B/op 44 allocs/op
193+
BenchmarkCollection_Query_NoContent_5000-8 351 4264192 ns/op 166728 B/op 44 allocs/op
194+
BenchmarkCollection_Query_NoContent_25000-8 75 16411744 ns/op 813928 B/op 44 allocs/op
195+
BenchmarkCollection_Query_NoContent_100000-8 18 64670962 ns/op 3205962 B/op 44 allocs/op
196+
BenchmarkCollection_Query_100-8 10923 109936 ns/op 6480 B/op 44 allocs/op
197+
BenchmarkCollection_Query_1000-8 2184 562778 ns/op 35667 B/op 44 allocs/op
198+
BenchmarkCollection_Query_5000-8 400 2986732 ns/op 166750 B/op 44 allocs/op
199+
BenchmarkCollection_Query_25000-8 88 15433911 ns/op 813896 B/op 44 allocs/op
200+
BenchmarkCollection_Query_100000-8 19 63696478 ns/op 3205982 B/op 44 allocs/op
201+
PASS
202+
ok github.com/philippgille/chromem-go 31.373s
203+
```
204+
185205
## Motivation
186206

187207
In December 2023, when I wanted to play around with retrieval augmented generation (RAG) in a Go program, I looked for a vector database that could be embedded in the Go program, just like you would embed SQLite in order to not require any separate DB setup and maintenance. I was surprised when I didn't find any, given the abundance of embedded key-value stores in the Go ecosystem.

0 commit comments

Comments
 (0)