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

Add a way to create JsString from single ASCII literal without heap allocation #3927

Closed

Conversation

CrazyboyQCD
Copy link
Contributor

@CrazyboyQCD CrazyboyQCD commented Jul 19, 2024

Use js_string macro to create JsString from an ASCII literal currently causes heap allocation except for the StaticJsStrings, and StaticJsStrings is hard for compiler to do constant evaluation because of the HashMap.

Godbolt Link.
This adds a way to create JsString from ASCII literal without heap allocation and it is easy for compiler to evaluate constantly, you could view the asm result in the link.

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Project coverage is 50.90%. Comparing base (6ddc2b4) to head (a12fc23).
Report is 215 commits behind head on main.

Files Patch % Lines
core/string/src/lib.rs 89.65% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3927      +/-   ##
==========================================
+ Coverage   47.24%   50.90%   +3.65%     
==========================================
  Files         476      467       -9     
  Lines       46892    44643    -2249     
==========================================
+ Hits        22154    22725     +571     
+ Misses      24738    21918    -2820     

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

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.

1 participant