5 ms·
Go is perhaps not the best tool to use for this as calling sqlite via Cgo will incur a penalty. Might be significant in a very hot loop.
by tyho 5y ago
Go is perhaps not the best tool to use for this as calling sqlite via Cgo will incur a penalty. Might be significant in a very hot loop.
- christophilus 5y agoGo’s the tool I’m using to build a side project, so I was really only curious about Go + SQLite vs Go + file system.
- jchw 5y agoYou might find these projects interesting: - https://pkg.go.dev/modernc.org/ql https://pkg.go.dev/modernc.org/ql - https://pkg.go.dev/modernc.org/sqlite https://pkg.go.dev/modernc.org/sqlite It’s hard to find much information about them, but the first one seems to be a database similar to sqlite, and the latter seems to be some kind of automated translation of sqlite to Go. I’m not sure either of these will outperform sqlite on CGo, but both of them should eliminate the CGo overhead and might give you some more room. P.S.: The latter is a bit unorthodox in that it contains separate code for each architecture supported by Go, most likely a reflection of the method of the automated translation.
- christophilus 5y agoI hadn’t heard of ql, but I tried the latter project, and it was much slower for inserts. Something like 500/second.
- chakkepolja 5y agodepending on your data, there's also Keyvalue stores like boltdb & badger.
- derefr 5y agoI believe https://github.com/erthink/libmdbx https://github.com/erthink/libmdbx is the highest-throughput transactional KV store with a Golang binding right now. (It’s the current storage backend for https://github.com/ledgerwatch/erigon https://github.com/ledgerwatch/erigon, which switches quickly to whatever wacky library is optimally performant at the moment.)