News for hackers. Stuff that matters.
Re:sqlite: A CGo-free port of SQLite/SQLite3 by blubber on Sunday June 07, 2026 @04:05PM (#48438035)
Because it's cgo-free maybe?
Re:sqlite: A CGo-free port of SQLite/SQLite3 by usrnm on Sunday June 07, 2026 @04:11PM (#48438088)
Cgo overhead is trivial compared to what's happening inside a database engine, totally not worth it
Re:sqlite: A CGo-free port of SQLite/SQLite3 by figmert on Sunday June 07, 2026 @04:28PM (#48438217)
Absolutely not. Maybe runtime overheads are minimal, but builds are so much harder to do. And yes, you need to figure it out maybe once, but it is still a lot more effort than just pulling in a new dependency. Now repeat that same effort for every new application, vs pulling that into every new application.
Re:sqlite: A CGo-free port of SQLite/SQLite3 by anupcshan on Sunday June 07, 2026 @04:32PM (#48438255)
It's not just about overhead/performance. cgo-free means no need to set up a cross-compiler if targeting other devices. Just "go build" with the right GOARCH and GOOS will let you compile a binary that will run on most devices.
Re:sqlite: A CGo-free port of SQLite/SQLite3 by dizhn on Sunday June 07, 2026 @04:38PM (#48438303)
Static builds cannot have cgo too if I am not mistaken.
Re:sqlite: A CGo-free port of SQLite/SQLite3 by agwa on Sunday June 07, 2026 @05:07PM (#48438556)
The following go flags let you build statically-linked cgo binaries, provided that all the C libraries that you're using support static linking and don't call the NSS functions in glibc:

-tags netgo,osusergo -linkmode external -extldflags -static

I regularly compile (cross-compile, even) static Go binaries that use the cgo sqlite package. But it's certainly a lot simpler if you can avoid cgo.

Re:sqlite: A CGo-free port of SQLite/SQLite3 by usrnm on Sunday June 07, 2026 @04:38PM (#48438302)
I'm pretty sure that C is a much better choice if you really care about binaries that run on most devices
Re:sqlite: A CGo-free port of SQLite/SQLite3 by Ferret7446 on Sunday June 07, 2026 @04:44PM (#48438356)
Depends on what you mean by "most". The cross compile story for Go is far superior to C for the platforms it supports.
Re:sqlite: A CGo-free port of SQLite/SQLite3 by anupcshan on Sunday June 07, 2026 @05:59PM (#48439002)
This project is for using Sqlite from Go code. It is not a general purpose replacement.
Re:sqlite: A CGo-free port of SQLite/SQLite3 by raggi on Sunday June 07, 2026 @04:35PM (#48438284)
that’s really not true when the database is all in memory, statements are prepared, and so on.

but the overheads also stack up, the database/sql api is fairly allocation heavy too unless you do a lot of work and that friction increases quite a bit with the ffi boundary.

this is not to suggest “modernc is faster” - it’s not for a lot a workloads.

there are opportunities for optimization all over both approaches.