Optimize FindFirstCharToEncode for JavaScriptEncoder.Default and Relaxed using Sse2...
authorAhson Khan <ahson_ahmedk@yahoo.com>
Wed, 23 Oct 2019 00:34:24 +0000 (17:34 -0700)
committerGitHub <noreply@github.com>
Wed, 23 Oct 2019 00:34:24 +0000 (17:34 -0700)
commit2aaf17200d2e6e6389899b5c84aca999d1bc6253
tree7ba22cc43f0032bc55e0772fbb19bdd092f1a053
parent57903fc1fbf7a19af40795e803b4a78c9b81d062
Optimize FindFirstCharToEncode for JavaScriptEncoder.Default and Relaxed using Sse2 intrinsics. (dotnet/corefx#41933)

* Optimize FindFirstCharToEncode for JavaScriptEncoder.Default and Relaxed
using Sse2 intrinsics.

* Create an Sse2Helper and improve perf of TextEncoder and
AllowedCharactersBitmap

* Loop unroll FindFirstCharacterToEncode

* Improve code coverage.

* Add more tests for surrogate pairs and fix call to WillEncode.

* Address PR feedback - remove some code duplication.

* Move DefaultJavaScriptEncoder to separate file and override EncodeUtf8
with better caching.

* Add default replacement character as a test.

* Address nits.

Commit migrated from https://github.com/dotnet/corefx/commit/c4b93b6768a5edd6416145de108c584a855aef26
src/libraries/System.Text.Encodings.Web/src/Configurations.props
src/libraries/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj
src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/DefaultJavaScriptEncoder.cs [new file with mode: 0644]
src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/DefaultJavaScriptEncoderBasicLatin.cs [new file with mode: 0644]
src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/JavaScriptEncoder.cs
src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/JavaScriptEncoderHelper.cs [new file with mode: 0644]
src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/Sse2Helper.cs [new file with mode: 0644]
src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoder.cs
src/libraries/System.Text.Encodings.Web/src/System/Text/Encodings/Web/UnsafeRelaxedJavaScriptEncoder.cs
src/libraries/System.Text.Encodings.Web/src/System/Text/Internal/AllowedCharactersBitmap.cs
src/libraries/System.Text.Encodings.Web/tests/JavaScriptStringEncoderTests.cs