-
Notifications
You must be signed in to change notification settings - Fork 41
Statically linked with libsqlite3.a with LTO enabled #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
in `cargo build` Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
that automatically compile sqlite3 Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Since sqlx adds feature `bundled` to `libsqlite3-sys` which is used by `rusqlite`, preventing from using my LTO compiled libsqlite3.a, I added a feature to disable it. Signed-off-by: Jiahao XU <[email protected]>
SQLITE3_INCLUDE_DIR is necessary since libsqlite3-sys does not use sqlite3.pc found using `SQLITE3_LIB_DIR` for locating the header. Signed-off-by: Jiahao XU <[email protected]>
This benchmark result is outdated
It seems that linking with sqlite3 with LTO does provides some minor benefit. |
I looked at the assembly and found that not all I think this might have something to do with the default
Since And, |
Signed-off-by: Jiahao XU <[email protected]>
The latest commit enables However, I currently don't have any time to benchmark this new commit. |
Here's the up-to-date benchmark:
However, after investigation, I still found many |
Signed-off-by: Jiahao XU <[email protected]>
I think I have been mistaken, as the |
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
By doing the Here's the benchmark:
There isn't much improvments, so I will use |
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Here are the flamegraphs for the rust binaries. |
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
This PR enables binaries who uses
rusqlite
to statically linked withlibsqlite3.a
compiled with LTO using linker-plugin-lto.To compile these binaries (excluding
basic_async.rs
), just runmake -j $(nproc)
.It will compile
sqlite3.c
usingCFLAGS='-O2 -flto'
.The generated binaries will be smaller,
though I haven't tested the performance yet, I will add the benchmark below as a commentbut only provides minor performance improvements (see comments below)It seems that I didn't enable LTO in rust (see comments below).To compile
basic_async.rs
, runcargo build --release --bin basic_async --features async-sql
.This PR might be related to #14
Signed-off-by: Jiahao XU [email protected]