-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
[Merged by Bors] - Cleanup inline annotations #2493
Conversation
Test262 conformance changes
|
Codecov Report
@@ Coverage Diff @@
## main #2493 +/- ##
==========================================
+ Coverage 52.74% 52.80% +0.05%
==========================================
Files 344 343 -1
Lines 34952 34874 -78
==========================================
- Hits 18435 18414 -21
+ Misses 16517 16460 -57
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Benchmark for 78e2605Click to view benchmark
|
Everything looks good! This should be alright then. |
Huh, the spaces between docs and functions are the kind of thing I expected rustfmt to catch, but I guess not... |
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.
Just have the one question regarding why you removed the From<&Value> for Value
implementation.
Also I don't want to spam with a bunch of comments that say the same, but there were a few functions where instead of deleting the line with the #[inline]
annotation you replaced it with an empty line.
I think having the empty line between doc-comments/other annotations and the functions doesn't help readability, it's nice to have them be close together to I'd prefer you made them all the same.
edit: nvm, you've handled it and I agree, weird that rustfmt doesn't handle it
impl From<&Self> for JsValue { | ||
#[inline] | ||
fn from(value: &Self) -> Self { | ||
value.clone() | ||
} | ||
} | ||
|
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 what made it so you had to add the .clone()
s around the code-base right?
Why did you remove it?
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.
Mainly because Rust tends to be very explicit about new allocations, and a From<&T> for T
implementation goes against that.
Benchmark for cc4bbfaClick to view benchmark
|
Benchmark for 9d8c6d2Click to view benchmark
|
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.
Looks good. I like it.
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.
Looks good! But why are all this clones added?
Current discussion about this: #2493 (comment) |
8316564
to
daed3c8
Compare
Benchmark for a886c8fClick to view benchmark
|
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.
Looks good to me! Thanks! :)
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.
bors r+
Per the [Standard Library development guide](https://std-dev-guide.rust-lang.org/code-considerations/performance/inline.html): > You can add `#[inline]`: > > - To public, small, non-generic functions. > > You shouldn't need `#[inline]`: > - On methods that have any generics in scope. > - On methods on traits that don't have a default implementation. > > `#[inline]` can always be introduced later, so if you're in doubt they can just be removed. This PR follows this guideline to reduce the number of `#[inline]` annotations in our code, removing the annotation in: - Non-public functions - Generic functions - Medium and big functions. Hopefully this shouldn't impact our perf at all, but let's wait to see the benchmark results.
Pull request successfully merged into main. Build succeeded: |
Per the Standard Library development guide:
This PR follows this guideline to reduce the number of
#[inline]
annotations in our code, removing the annotation in:Hopefully this shouldn't impact our perf at all, but let's wait to see the benchmark results.