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

perf: Introduce SourceSlice #9055

Closed
wants to merge 21 commits into from
Closed

perf: Introduce SourceSlice #9055

wants to merge 21 commits into from

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Jun 15, 2024

Description:

SourceSlice is sort of &' input str that is owned. It works by using Lrc<str>, which is the type of SourceFile.src. This type is used to avoid (enormous amount of) allocations for raw fields. With this PR, raw fields are now SourceSlice, which does not allocate.

BREAKING CHANGE:

  • swc_common::SourceFile.src is now Lrc<str> instead of Lrc<String>.
  • swc_common::input::StringInput now takes &'a Lrc<str> instead of &'a str.

@kdy1 kdy1 added this to the Planned milestone Jun 15, 2024
@kdy1 kdy1 self-assigned this Jun 15, 2024
@kdy1 kdy1 changed the title Src slice perf(common): Introduce SourceSlice Jun 15, 2024
@kdy1 kdy1 changed the title perf(common): Introduce SourceSlice perf: Introduce SourceSlice Jun 15, 2024
@kdy1 kdy1 force-pushed the src-slice branch 2 times, most recently from 8caf235 to bdf8fe7 Compare June 15, 2024 09:07
@kdy1
Copy link
Member Author

kdy1 commented Jun 15, 2024

I'll postpone this PR. Performance difference is about ~2%

@kdy1
Copy link
Member Author

kdy1 commented Jun 19, 2024

With boxing, the performance is much better.
The problem is now rkyv implementations for Wasm plugins...

Gnuplot not found, using plotters backend
es/lexer/cal-com        time:   [5.8715 ms 5.8856 ms 5.9024 ms]
                        change: [-4.0248% -3.7259% -3.4050%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) high mild
  5 (5.00%) high severe

     Running benches/parser.rs (/Users/kdy1/projects/s/perf/target/release/deps/parser-b0b086eaa04716f6)
Gnuplot not found, using plotters backend
es/parser/cal-com       time:   [14.626 ms 14.713 ms 14.815 ms]
                        change: [-3.0856% -2.3994% -1.6524%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  7 (7.00%) high mild
  9 (9.00%) high severe

@kdy1 kdy1 closed this Jul 15, 2024
@kdy1 kdy1 deleted the src-slice branch July 15, 2024 10:24
@kdy1 kdy1 modified the milestones: Planned, v1.7.0 Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant