Skip to content
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

refactor: remove double-allocation for enum CST decode #1500

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

Desdaemon
Copy link
Contributor

@Desdaemon Desdaemon commented Dec 26, 2023

Changes

(CST) Remove *mut Enum_Variant and inflate functions in favor of MaybeUninit. This reduces 1-2 allocations per enum instantiation and should reduce binary size somewhat.

Checklist

  • An issue to be fixed by this PR is listed above.
  • New tests are added to ensure new features are working. Please refer to this page to see how to add a test.
  • ./frb_internal precommit --mode slow (or fast) is run (it internal runs code generator, does auto formatting, etc).
  • If this PR adds/changes features, documentations (in the ./website folder) are updated.
  • CI is passing. Please refer to this page to see how to solve a failed CI.

Remark for PR creator

  • ./frb_internal --help shows utilities for development.
  • If fzyzcjy does not reply for a few days, maybe he just did not see it, so please ping him.

@Desdaemon Desdaemon changed the title feat: remove double-allocation for enum CST decode refactor: remove double-allocation for enum CST decode Dec 26, 2023
Copy link

codecov bot commented Dec 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a8e8d90) 99.20% compared to head (706e04e) 99.19%.
Report is 27 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1500      +/-   ##
==========================================
- Coverage   99.20%   99.19%   -0.01%     
==========================================
  Files         341      341              
  Lines       13141    13098      -43     
==========================================
- Hits        13036    12993      -43     
  Misses        105      105              

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

@fzyzcjy
Copy link
Owner

fzyzcjy commented Dec 27, 2023

Great optimization! Just two nits (discussions).

@Desdaemon Desdaemon force-pushed the remove-enum-alloc branch 3 times, most recently from af8af19 to 1f48422 Compare December 27, 2023 16:02
Copy link
Owner

@fzyzcjy fzyzcjy left a comment

Choose a reason for hiding this comment

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

LGTM! Just one nit about ManuallyDrop

@fzyzcjy
Copy link
Owner

fzyzcjy commented Dec 28, 2023

(I will review after a sleep, roughly 8 hours later - with a brief look this LGTM and ready to merge :) )

@fzyzcjy fzyzcjy merged commit 2c16ea3 into fzyzcjy:master Dec 29, 2023
76 checks passed
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