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 ASCII fast path from rust-lang #20

Merged
merged 1 commit into from
Apr 28, 2021
Merged

Conversation

epage
Copy link

@epage epage commented Apr 28, 2021

See rust-lang/rust's src/librustc_lexer/src/lib.rs

Idea came from #13

See rust-lang/rust's `src/librustc_lexer/src/lib.rs`

Idea came from unicode-rs#13
@Manishearth Manishearth merged commit 3786a0b into unicode-rs:master Apr 28, 2021
@epage epage deleted the fast-path branch April 28, 2021 15:32
@epage
Copy link
Author

epage commented Apr 28, 2021

Used #21 to verify the performance impact

nicodeXID/is_xid_start/unicode
                        time:   [123.69 us 124.69 us 125.78 us]
                        thrpt:  [93.159 MiB/s 93.978 MiB/s 94.738 MiB/s]
                 change:
                        time:   [+13.170% +14.656% +16.131%] (p = 0.00 < 0.05)
                        thrpt:  [-13.890% -12.782% -11.638%]
                        Performance has regressed.
Found 13 outliers among 100 measurements (13.00%)
  4 (4.00%) high mild
  9 (9.00%) high severe
UnicodeXID/is_xid_start/ascii
                        time:   [273.80 ns 275.31 ns 276.97 ns]
                        thrpt:  [437.30 MiB/s 439.93 MiB/s 442.36 MiB/s]
                 change:
                        time:   [-75.168% -74.925% -74.661%] (p = 0.00 < 0.05)
                        thrpt:  [+294.66% +298.80% +302.70%]
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low mild
  6 (6.00%) high mild
  1 (1.00%) high severe
UnicodeXID/is_xid_continue/unicode
                        time:   [153.25 us 154.10 us 155.12 us]
                        thrpt:  [75.541 MiB/s 76.039 MiB/s 76.464 MiB/s]
                 change:
                        time:   [+44.472% +46.282% +47.760%] (p = 0.00 < 0.05)
                        thrpt:  [-32.323% -31.639% -30.782%]
                        Performance has regressed.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low severe
  1 (1.00%) low mild
  1 (1.00%) high mild
  8 (8.00%) high severe
UnicodeXID/is_xid_continue/ascii
                        time:   [96.254 ns 97.036 ns 97.898 ns]
                        thrpt:  [1.2082 GiB/s 1.2189 GiB/s 1.2288 GiB/s]
                 change:
                        time:   [-91.110% -91.035% -90.961%] (p = 0.00 < 0.05)
                        thrpt:  [+1006.3% +1015.4% +1024.9%]
                        Performance has improved.

@SimonSapin
Copy link
Contributor

If rustc contains a copy of this code, could efforts be unified?

Perhaps with a crate in a new repo in the rust-lang org, or even publishing to crates.io directly from rust-lang/rust?

@epage
Copy link
Author

epage commented Apr 28, 2021

@SimonSapin if I'm reading librustc_lexer, it does pull in this crate. It just added a ascii fast path on top of it. Once librustc_lexer upgrades to a new release of this crate, the fast path will become redundant and could be removed.

@SimonSapin
Copy link
Contributor

Ah I see, thanks!

@epage
Copy link
Author

epage commented Apr 28, 2021

@Manishearth whats the release process for this crate? I'm wondering when I could take advantage of this PR.

@Manishearth
Copy link
Member

@epage make a PR with a new version, I'll merge and publish

@epage
Copy link
Author

epage commented Apr 28, 2021

@epage make a PR with a new version, I'll merge and publish

Sounds good, thanks!

#22

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.

3 participants