Sqlx: 0.4 performance decrease

Created on 14 Nov 2020  路  3Comments  路  Source: launchbadge/sqlx

Hello,

I wrote a benchmark to help me in the development of my postgresql crate, but the result of the update to 0.4 may interess you: https://github.com/elephantry/benchmark/commit/1355a95a5770118f6c5764da8e087020287f7445?short_path=3b8c4a9#diff-3b8c4a9f770124569b674a59525322ea77fb31bd9ef1e6a8edb68639e9ecec5b

The corresponding code:

sqlx::query_as::<_, User>("SELECT id, name, hair_color, created_at, null as posts FROM users").fetch_all(self)

Most helpful comment

I tried to do some git bisecting using the benchmark tool that @sanpii referred to. I had to skip some commits because of compilation error and I found that https://github.com/launchbadge/sqlx/commit/9b68eb19 is the first bad commit that I could run and https://github.com/launchbadge/sqlx/commit/a233fbfd is the last good commit that I could run:

https://github.com/launchbadge/sqlx/commit/a233fbfd:

test sqlx::query_all       ... bench:   9,357,750 ns/iter (+/- 1,016,965)

https://github.com/launchbadge/sqlx/commit/9b68eb19:

test sqlx::query_all       ... bench:  24,725,440 ns/iter (+/- 19,397,179)

All 3 comments

I've seen the same kind of decrease in my project since upgrading from 0.3.5 to 0.4.1. I will try to create a small reproducible version of it later to showcase it

I tried to do some git bisecting using the benchmark tool that @sanpii referred to. I had to skip some commits because of compilation error and I found that https://github.com/launchbadge/sqlx/commit/9b68eb19 is the first bad commit that I could run and https://github.com/launchbadge/sqlx/commit/a233fbfd is the last good commit that I could run:

https://github.com/launchbadge/sqlx/commit/a233fbfd:

test sqlx::query_all       ... bench:   9,357,750 ns/iter (+/- 1,016,965)

https://github.com/launchbadge/sqlx/commit/9b68eb19:

test sqlx::query_all       ... bench:  24,725,440 ns/iter (+/- 19,397,179)

I really appreciate all of this. Performance is going to become a priority for 0.5 and beyond. Currently we've paid very little attention to how fast the driver is.

Self-contained benchmarks that we can run on 0.3, 0.4, and soon 0.5 will help. I'm less interested at this time for how it runs compared to another postgres crate.

Was this page helpful?
0 / 5 - 0 ratings