-
-
Notifications
You must be signed in to change notification settings - Fork 218
Update value bench and unbox variants based on the result #946
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
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 { |
There was a problem hiding this comment.
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.
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 inExpr::Binary
.