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

Rename AsciiWordChar and optimize Codepoint #75

Merged
merged 2 commits into from
Dec 18, 2017

Conversation

pitdicker
Copy link

This renames AsciiWordChar to Alphanumeric.
And just after making the Avoid low bits PR, I changed AsciiWordChar to use the low bits (?!). Better use a shift than a mask now.

Adding the [inline] attribute to RangeInt::new and RangeInt::new_inclusive helps LLVM to calculate the range and zone at compile time if the range is constant. That makes it a better choice than the current bitmask or even simple_range for Codepoint.

Benchmarks before:

test distr_uniform_ascii_char ... bench:       2,785 ns/iter (+/- 59) = 1436 MB/s
test distr_uniform_codepoint  ... bench:       9,792 ns/iter (+/- 36) = 408 MB/s

After

test distr_uniform_alphanumeric ... bench:       2,654 ns/iter (+/- 54) = 1507 MB/s
test distr_uniform_codepoint    ... bench:       2,799 ns/iter (+/- 5) = 1429 MB/s

@dhardy dhardy merged commit e3c8ca1 into dhardy:master Dec 18, 2017
@pitdicker pitdicker deleted the char_distrs branch December 19, 2017 11:58
@pitdicker pitdicker mentioned this pull request Dec 24, 2017
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.

2 participants