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

Speed up walkLength for narrow strings #7755

Merged
merged 1 commit into from
Jan 25, 2021
Merged

Conversation

n8sh
Copy link
Member

@n8sh n8sh commented Jan 19, 2021

walkLength can be significantly sped up for narrow strings in the common case where they begin with a run of characters that do not require decoding.

Benchmark on my laptop for 12 character all-ASCII string:

compile command string size old MB/s new MB/s ratio
dmd 12 86.30 409.17 4.7x
dmd -O 12 92.85 840.56 9.1x
dmd -O -inline 12 298.88 842.44 2.8x
ldc2 12 75.58 474.29 6.3x
ldc2 -O3 12 727.53 2248.80 3.1x

Benchmark on my laptop for 2000 character all-ASCII string:

compile command string size old MB/s new MB/s ratio
dmd 2000 94.06 425.60 4.5x
dmd -O 2000 102.77 1047.31 10.2x
dmd -O -inline 2000 239.56 1055.37 4.4x
ldc2 2000 86.29 465.99 5.4x
ldc2 -O3 2000 626.03 2604.25 4.2x

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @n8sh!

Bugzilla references

Auto-close Bugzilla Severity Description
21559 enhancement Speed up walkLength for narrow strings

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#7755"

@n8sh n8sh force-pushed the issue-21559 branch 3 times, most recently from eeeba30 to b534a2e Compare January 19, 2021 15:49
@RazvanN7 RazvanN7 added the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Jan 20, 2021
@RazvanN7 RazvanN7 merged commit 62c1f08 into dlang:master Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge:72h no objection -> merge The PR will be merged if there are no objections raised. Severity:Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants