Skip to content

Add ASCII fast path from rust-lang - #20

Merged
Manishearth merged 1 commit into
unicode-rs:masterfrom
epage:fast-path
Apr 28, 2021
Merged

Add ASCII fast path from rust-lang#20
Manishearth merged 1 commit into
unicode-rs:masterfrom
epage:fast-path

Conversation

@epage

@epage epage commented Apr 28, 2021

Copy link
Copy Markdown

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

epage commented Apr 28, 2021

Copy link
Copy Markdown
Author

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
Copy Markdown
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

epage commented Apr 28, 2021

Copy link
Copy Markdown
Author

@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
Copy Markdown
Contributor

Ah I see, thanks!

@epage

epage commented Apr 28, 2021

Copy link
Copy Markdown
Author

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

@Manishearth

Copy link
Copy Markdown
Member

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

@epage

epage commented Apr 28, 2021

Copy link
Copy Markdown
Author

@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