You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We seek to speed up the `Utf8Utility.GetPointerToFirstInvalidByte` function. Using the algorithm used by Node.js, Oracle GraalVM and other important systems.
(We may need to speed up `Ascii.GetIndexOfFirstNonAsciiByte` first, see issue https://github.com/simdutf/SimdUnicode/issues/1.)
11
+
- John Keiser, Daniel Lemire, [Validating UTF-8 In Less Than One Instruction Per Byte](https://arxiv.org/abs/2010.03090), Software: Practice and Experience 51 (5), 2021
17
12
18
-
The question is whether we could do it using this routine:
13
+
The function is private in the Runtime, but we can expose it manually.
19
14
20
-
* John Keiser, Daniel Lemire, [Validating UTF-8 In Less Than One Instruction Per Byte](https://arxiv.org/abs/2010.03090), Software: Practice and Experience 51 (5), 2021
21
-
22
-
Our generic implementation is available there: https://github.com/simdutf/simdutf/blob/master/src/generic/utf8_validation/utf8_lookup4_algorithm.h
Copy file name to clipboardExpand all lines: benchmark/ASCII_runtime.cs
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,18 @@
8
8
usingSystem.Runtime.Intrinsics.Arm;
9
9
usingSystem.Runtime.Intrinsics.X86;
10
10
11
+
// This is from the Runtime. Copy/pasted as I found no other way to benchmark it.
12
+
11
13
//Changes from original:
12
14
//copy pasted CompExactlyDependsOnAttribute : Attribute into System.Text namespace
13
15
//copy/pasted StoreLowerUnsafe into ascii class
14
16
//The various Vector.Size likely refer to size in bytes so
15
17
//Replaced all instances of Vector512.Size by 64 (see:https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs,77df495766d5de9c)
16
18
//Vector256's by 32 (see:https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs,877aa6254c4e4d00)
17
19
//Vector128's by 16 (see:https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs,eb1e72a6f843c5a5)
20
+
// GetIndexofFirstNonAsciiByte is no longer internal
18
21
19
-
namespaceCompetition
22
+
namespaceDotnetRuntime
20
23
{
21
24
// I copy pasted this from: https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CompExactlyDependsOnAttribute.cs
22
25
// Use this attribute to indicate that a function should only be compiled into a Ready2Run
0 commit comments