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
Add #[inline]
and #[cold]
in far more places
#834
Conversation
Codecov Report
@@ Coverage Diff @@
## master #834 +/- ##
==========================================
- Coverage 77.31% 77.21% -0.11%
==========================================
Files 48 48
Lines 5506 5512 +6
==========================================
- Hits 4257 4256 -1
- Misses 1249 1256 +7
Continue to review full report at Codecov.
|
@@ -127,21 +136,13 @@ pub struct MappedRows<'stmt, F> { | |||
map: F, | |||
} | |||
|
|||
impl<'stmt, T, F> MappedRows<'stmt, F> |
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.
MappedRows::new isn't needed if we just implement query_map
in terms of query(...).mapped
which this patch does too. These changes are unrelated but accidentally got rolled into this patch due to me forgetting to stash some WIP stuff, but it doesn't change behavior or the public API at all and reduces the amount of code.
Ditto for AndThenRows::new
Type::Real => write!(f, "Real"), | ||
Type::Text => write!(f, "Text"), | ||
Type::Blob => write!(f, "Blob"), | ||
Type::Null => f.pad("Null"), |
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.
This is unrelated but allows us to work in cases where a align/width/etc format args are provided. Admittedly, IDK how relevant that is here, but it's better to use Formatter::pad for this sort of thing and I noticed it.
This is probably more aggressive about #[inline] than it would be if written from scratch, but this allows a lot of rusqlite code to be much lower overhead compared to direct SQLite api usage when compiled in release mode (#[inline] does nothing in debug mode). Without this, you could still have that benefit with |
(Going to land this w/o review, but if you have an issue @gwenn I'm okay with reverting it and filing a PR that goes through review) |
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.
LGTM
Fixes #832
I added inline to anything small enough or where the compiler would be able to DCE it. I added cold to functions hit in error paths (even if they're small). I also avoided inlining deprecated functions and std::fmt::Display impls, etc.
This also has a few unrelated changes that I noticed when I went through every file.