My problem is no matter how I build sqlite - my binary is much slower than the precompiled one on sqlite download page (about 3 - 6 times depending on the query).
I am using sqlite3.h and sqlite3.c from the amalgamation source:
http://www.sqlite.org/sqlite-amalgamation-3070602.zip
I have added the following flags when compiling sqlite:
gcc
-s -O4 -I. -fomit-frame-pointer
-DNDEBUG
-DSQLITE_OS_WIN=1
-DSQLITE_HAVE_READLINE=0
-DSQLITE_THREADSAFE=1
-DSQLITE_TEMP_STORE=2
-DSQLITE_ENABLE_RTREE
-DSQLITE_ENABLE_FTS3
-DSQLITE_OMIT_COMPILEOPTION_DIAGS
-DSQLITE_ENABLE_COLUMN_METADATA
-DNO_TCL
I built it both with MINGW and with MSVS 2010.
Does anyone one know how to build sqlite to get the same binary as on download page ?
Any help would be appreciated.
SQLiteStudio. The SQLiteStudio tool is a free GUI tool for managing SQLite databases. It is free, portable, intuitive, and cross-platform. SQLite tool also provides some of the most important features to work with SQLite databases such as importing, exporting data in various formats including CSV, XML, and JSON.
SQLite is often used as the on-disk file format for desktop applications such as version control systems, financial analysis tools, media cataloging and editing suites, CAD packages, record keeping programs, and so forth. The traditional File/Open operation calls sqlite3_open() to attach to the database file.
Follow the guide on SQLite wiki : How to compile and check what are the arguments Make
passes to the compiler. My first suspect would be -O4
, as the highest level GCC understands is -O3
, and even this usually turns out worse than -O2
or -Os
(because small size == no CPU cache misses, and -O3
bloats the binary really badly).
Although I can see the approach differs: Build On Windows Without Tcl uses -O2
, but ticket #931 uses the damned -O4
"Gentoo Ricer Mode". Either way, those optimization switches aren't worth much without specifying target architecture: try -march=core2
or -march=native
for auto-detection, but remember that such code won't work on earlier CPUs. -march=nocona
will work on anything newer than Pentium 4 and still gives the compiler a lot of room for useful optimizations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With