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

Reduce file string allocations #788

Merged
merged 1 commit into from
Feb 10, 2024

Conversation

xezon
Copy link
Contributor

@xezon xezon commented Nov 9, 2022

Reduces unnecessary string allocations in file class. Optimization.

The way it works is Utf8String is reference counted. So by having a static string, constructor can borrow this static and simply increase its ref count when assigning it. It no longer needs to allocate this "<no file>" string, effectively elimitating 1 wasted allocation per file open.

@tomsons26 tomsons26 force-pushed the optimize-file-string-alloc branch from 4369b5c to 39e15bb Compare February 5, 2024 23:08
@xezon xezon force-pushed the optimize-file-string-alloc branch from 39e15bb to be3b654 Compare February 10, 2024 07:27
@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fc578f0) 2.53% compared to head (be3b654) 2.53%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #788   +/-   ##
========================================
  Coverage     2.53%    2.53%           
========================================
  Files          949      949           
  Lines       110292   110293    +1     
  Branches     18881    18881           
========================================
+ Hits          2799     2800    +1     
  Misses      107089   107089           
  Partials       404      404           

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

@xezon
Copy link
Contributor Author

xezon commented Feb 10, 2024

Tested and works correctly.

@xezon xezon merged commit dbfc5bc into TheAssemblyArmada:develop Feb 10, 2024
7 checks passed
@xezon xezon deleted the optimize-file-string-alloc branch February 10, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants