Skip to content

Comments

Avoid allocations in Serializer when write numbers and characters#909

Merged
Mingun merged 2 commits intotafia:masterfrom
Mingun:faster-writing
Oct 29, 2025
Merged

Avoid allocations in Serializer when write numbers and characters#909
Mingun merged 2 commits intotafia:masterfrom
Mingun:faster-writing

Conversation

@Mingun
Copy link
Collaborator

@Mingun Mingun commented Oct 29, 2025

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.18%. Comparing base (38b44d4) to head (6336c8b).
⚠️ Report is 84 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #909      +/-   ##
==========================================
+ Coverage   55.52%   58.18%   +2.65%     
==========================================
  Files          42       42              
  Lines       15511    15547      +36     
==========================================
+ Hits         8613     9046     +433     
+ Misses       6898     6501     -397     
Flag Coverage Δ
unittests 58.18% <100.00%> (+2.65%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

}

impl<W: Write> SimpleTypeSerializer<W> {
#[inline]
Copy link
Collaborator

@dralley dralley Oct 29, 2025

Choose a reason for hiding this comment

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

I'm pretty sure these #[inline] annotations do not actually accomplish anything. All it does is make the function bodies available to dependent crates for optimization purposes. But all of this code is internal to the crate anyway, and hence inline-able, and the compiler doesn't care about the #[inline] annotation when deciding whether or not to inline code within a compilation unit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm... good to know

Copy link
Collaborator

Choose a reason for hiding this comment

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

#[inline(always)] does have some effect within compilation units but usually in a case like this the compiler would already be making the correct decision, at least in release mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

While #[inline] is a prerequisite for cross-crate inlining as you describe, it still adjusts LLVM's heuristics even for within-crate inlining towards inlining, i.e. it can have an effect even for internal functions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've heard otherwise, but it's possible I'm wrong or that things have changed since I read about that.

@Mingun Mingun merged commit 4cd46e3 into tafia:master Oct 29, 2025
7 checks passed
@Mingun Mingun deleted the faster-writing branch October 29, 2025 19:55
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.

4 participants