Skip to content

gfoidl-Tests/SourceGenerator-Vectors

Repository files navigation

GeneratedIndexOfAnyAttribute

Prototype for Vectorize IndexOfAny on more than 5 chars.

Based on ideas from Optimize FindFirstCharToEncode for JavaScriptEncoder.Default using Ssse3 intrinsics, which is based on ideas from Base64 encoding with simd-support (these lines) which itself is based on Base64 decoding with SIMD instructions from Wojciech Muła and some other post from him.

The origin impulse for this approach was in Kestrel response header encoding where I did a quick prototype (which is in master-branch of this repo). After the PR Vectorized HttpCharacters got created Stephen Toub brought my attention the issue mentioned above. So this prototype got created.


Rough description on how the bitmask-approach works is given in this comment.