You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove more usages of JsStr in favor of just JsString (#4578)
Move the following to `JsString` (from `JsStr`):
- `get` and `get_expect` now return `JsString`. Uses `code_point_at()`
instead of `get(usize)`
- Move the display types to using a ref to the `JsString` being
displayed. Using a `JsString` reference instead of a clone makes it
clearer that calling `string.display()` should be temporary (and has a
lifetime).
- Move trim to `JsString` and return `JsString` directly.
- Have the code points iterator be part of the `JsString` API and its
`vtable`.
- Add inlines and other small time optimizations, like `trim()` not
slicing twice.
- This results in less conversions from JsStr to JsString. It's more
performant because creating a `JsString` from a slice is as fast (thanks
to `SliceString`) than a `JsStr` on a slice, but creating a `JsString`
from it is faster now.
The end goal is to get rid of `JsStr` in its current form.
Benchmarks on my machine:
| Benchmark | Main | This PR |
|--------------|------|---------|
| Richards | 235 | 255 |
| DeltaBlue | 245 | 254 |
| Crypto | 207 | 219 |
| RayTrace | 485 | 525 |
| EarleyBoyer | 594 | 632 |
| RegExp | 87.2 | 90.4 |
| Splay | 789 | 896 |
| NavierStokes | 484 | 490 |
| **Total** | 322 | 342 |
0 commit comments