Skip to content

Simd v2 - #91

Merged
CarlVerret merged 22 commits into
masterfrom
SIMD_v2
Oct 22, 2021
Merged

Simd v2#91
CarlVerret merged 22 commits into
masterfrom
SIMD_v2

Conversation

@CarlVerret

Copy link
Copy Markdown
Owner

This PR introduce SIMD operation for UTF-16 string parsing. It improves performance a lot. From now on performance of UTF-16 parsing is equivalent (if not faster) as UTF-8.

In some cases, it is up to 8 to 9 times faster than standard library.

MethodFileNameMeanErrorStdDevMinRatioMFloat/sMB/s
'FastFloat.TryParseDouble() - UTF8'data/canada.txt4.690 ms0.0053 ms0.0050 ms4.683 ms0.1223.73445.85
FastFloat.TryParseDouble()data/canada.txt4.586 ms0.0167 ms0.0148 ms4.559 ms0.1224.38458.00
'ParseNumberString() only'data/canada.txt2.472 ms0.0395 ms0.0370 ms2.411 ms0.0746.10866.13
Double.Parse()data/canada.txt37.537 ms0.2360 ms0.2208 ms37.159 ms1.002.9956.19
'FastFloat.TryParseDouble() - UTF8'data/mesh.txt1.833 ms0.0004 ms0.0003 ms1.832 ms0.2739.86338.41
FastFloat.TryParseDouble()data/mesh.txt1.834 ms0.0003 ms0.0003 ms1.834 ms0.2739.81338.05
'ParseNumberString() only'data/mesh.txt1.168 ms0.0021 ms0.0020 ms1.164 ms0.1762.71532.43
Double.Parse()data/mesh.txt6.850 ms0.0375 ms0.0351 ms6.788 ms1.0010.7691.34
'FastFloat.TryParseDouble() - UTF8'data/synthetic.txt5.295 ms0.0131 ms0.0109 ms5.283 ms0.1128.39534.13
FastFloat.TryParseDouble()data/synthetic.txt5.147 ms0.0154 ms0.0144 ms5.118 ms0.1129.31551.44
'ParseNumberString() only'data/synthetic.txt2.655 ms0.0025 ms0.0019 ms2.653 ms0.0556.541063.78
Double.Parse()data/synthetic.txt48.744 ms0.3320 ms0.3105 ms48.283 ms1.003.1158.45

@CarlVerret

Copy link
Copy Markdown
OwnerAuthor

@EgorBo : I request your opinion on this PR since your input had been such important previously. This new PR delivers a considerable performance improvement. Could you take a look and maybe update the PR for .net framework you did for us?

Another quick question : with C# would method chaining affect performance ? I mean as I have many overloads for methods ParseDouble and TryParseDouble with/without consumed_caracters optional variable, should chaining be avoided or it doesn't really matters ? I been trying to measure exactly how faster is TryParseDouble compared to ParseDouble (as the second calls the first). Chaining overloaded methods could save a couple of line of code and maybe it's a bit clearier but I am having a hard time trying to measure the exact cost of chaining.

Thanks a lot.

@CarlVerretCarlVerret linked an issue Oct 19, 2021 that may be closed by this pull request
Comment threadBenchmark/FastParserBenchmark.cs Outdated
Comment threadcsFastFloat/FastDoubleParser.cs Outdated
Comment threadcsFastFloat/FastDoubleParser.cs Outdated
Comment threadcsFastFloat/Utils/Utils.cs
Comment threadcsFastFloat/Utils/Utils.cs Outdated
@CarlVerret

Copy link
Copy Markdown
OwnerAuthor

@gfoidl i'm sure you'll be interested in this new PR. I had issues with previous one (I had some perf. regression with previous PR and had to step back a bit...)

Comment threadTestcsFastFloat/TestcsFastFloat.csproj Outdated
Comment threadcsFastFloat/Structures/ParsedNumberString.cs Outdated
Comment threadcsFastFloat/Utils/Utils.cs Outdated
Comment threadcsFastFloat/Utils/Utils.cs
Comment threadcsFastFloat/Utils/Utils.cs
Sign up for freeto 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.

Optimize Utils.strncasecmp for fixed length with SWAR

4 participants

@CarlVerret@lemire@EgorBo@gfoidl