Skip to content

Conversation

Huliiiiii
Copy link
Member

@Huliiiiii Huliiiiii commented Aug 3, 2025

PR Info

Update benchmarks and unbox Value based on the results.

Benchmarks show that in typical cases, making Value smaller does not improve performance. On the contrary, and each heap-allocated value will cause a 1-1.5% performance loss.

This makes sense, since Value is usually stored inside a Vec or a Box, such as in Expr::Binary.

@Huliiiiii
Copy link
Member Author

@Expurple @tyt2y3 Could you try running the benchmarks locally to see if you can reproduce my results?

@Huliiiiii
Copy link
Member Author

Well, BurntSushi/jiff#400 explains why I didn’t see any performance impact — in release mode, it’s effectively a comparison between 32 and 40.

const fn check_value_size() -> usize {
if std::mem::size_of::<Value>() > 32 {
panic!("the size of Value shouldn't be greater than 32 bytes")
if std::mem::size_of::<Value>() > 104 {
Copy link
Member

@tyt2y3 tyt2y3 Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sad, this basically makes this check useless, unless we relax it in debug mode and stricten it in release mode.
but our CI don't run release mode, so there is no checks anyway.
given that sqlx-binder is still WIP, I wouldn't act on this until there is full sqlx support and #943 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants