Conversation

Trying out `zig cc` as a CGO compiler for embedded sqlite. So far it's a good amount slower. First up, sqlite isn't using the intrinsics because of its preprocessor logic. Ok, fix that, some gap closed. Next apply march=haswell, often need a march w/ clang. Still 10+% to go..
2
4
Replying to
SQLite gets an easy performance win from disabling certain deprecated/optional functionality. -DSQLITE_DQS=0 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DEPRECATED -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE
1
Replying to and
They also intend for people to use -DSQLITE_USE_ALLOCA although alloca/VLAs aren't always available. If you can guarantee sqlite3_initialize is called before anything else you can use -DSQLITE_OMIT_AUTOINIT too. There are further performance wins from things with a safety cost.
1
Replying to and
For example, there's no reason you would need -DSQLITE_THREADSAFE=1 for Rust when you can already make sure nothing accesses connections / statements concurrently simply by using normal library design. That will get a lot more performance out of it than most micro-optimizations.
1