Skip to content

Conversation

@hansl
Copy link
Contributor

@hansl hansl commented Dec 22, 2025

This allows us to add more variants, like ASCII, later.

hansl and others added 18 commits December 14, 2025 20:48
This is the first in a series of PR to improve the performance of strings in Boa.

The first step was to introduce a new type of strings, `SliceString`, which contains a strong pointer to another string and start/end indices. This allows for very fast slicing of strings. This initially came at a performance cost by having an enumeration of kinds of strings. An intermediate experiment was introduced to have the kind be a tag on the internal JsString pointer. This still came as a cost as it required bit operations to figure out which function to call.

Finally, I moved to using a `vtable`. This helped with many points:
1. as fast as before. Before this PR, there was still a deref of a pointer when accessing internal fields.
2. we can now introduce many other types (which will come in their separate PRs).
3. this makes the code to clone/drop/as_str (and even construction) more streamline as each function is their own implementation.
String should never change length anyway, they are immutable in our
current design.
This allows us to add more variants, like ASCII, later.
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,598 52,598 0
Passed 49,385 49,382 -3
Ignored 2,134 2,134 0
Failed 1,079 1,082 +3
Panics 0 3 +3
Conformance 93.89% 93.89% -0.01%
New panics (3):
test/staging/sm/String/replaceAll.js (previously Passed)
test/built-ins/String/prototype/substring/S15.5.4.15_A2_T3.js (previously Passed)
test/annexB/built-ins/String/prototype/substr/start-and-length-as-numbers.js (previously Passed)

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 93.39623% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.28%. Comparing base (6ddc2b4) to head (a06ff98).
⚠️ Report is 620 commits behind head on main.

Files with missing lines Patch % Lines
core/string/src/builder.rs 89.28% 3 Missing ⚠️
core/string/src/vtable/sequence.rs 92.50% 3 Missing ⚠️
core/string/src/str.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4572       +/-   ##
===========================================
+ Coverage   47.24%   57.28%   +10.04%     
===========================================
  Files         476      509       +33     
  Lines       46892    58018    +11126     
===========================================
+ Hits        22154    33238    +11084     
- Misses      24738    24780       +42     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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