-
-
Notifications
You must be signed in to change notification settings - Fork 749
Removed auto-decoding from std.conv.parse #4597
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
Conversation
|
One benefit I forgot to mention is that this will also speed up This will give D a leg-up in a lot of benchmarks because |
|
Ping. This is a significant speed increase for a very common function. |
|
Thanks! Please add or refer in PR description a unittest that cover UTF (also note about UTF). Also please replace |
|
We need more such optimisations |
Shouldn't this usually be covered pretty well by peephole optimization/register allocation? |
What exactly are you looking for? Parse already ignores everything that's not a number. |
ee630b7 to
01010c5
Compare
|
Ping @9il |
|
Auto-merge toggled on |
|
@JackStouffer FYI attached issue 16451 to this PR ;-) |
Like the title says, I removed auto-decoding from
parse, which only checked for things in the ASCII range anyway.The reason why this is so messy is
parsetakes its range byref, sobyCodeUnitcannot be used without usingrefRange, which requires using&r, which is unsafe. So the only solution left is to do it manually with a bunch ofstatic ifs.I tried putting the
refRange.byCodeUnitin a@trustedblock, but that resulted in a speed pessimization (I'm guessing due to the inability to inline at that point).By my measurements, this is anywhere between 2.5-5x as fast as the original implementation.
UPDATE (Aug 8 2016): Changed benchmark at the behest of @9il
Here's the code I used to benchmark