コード例 #1
0
        public unsafe void ReverseEnumerateCodePointsConstructFromSpan(int length, int minCodePoint, int maxCodePoint, string description, bool useInnerLoop = false)
        {
            string     s     = GetRandomString(length, minCodePoint, maxCodePoint);
            Utf8String utf8s = new Utf8String(s);

            fixed(byte *bytes = utf8s.CopyBytes())
            {
                utf8s = new Utf8String(new Span <byte>(bytes, utf8s.Length));

                foreach (var iteration in Benchmark.Iterations)
                {
                    using (iteration.StartMeasurement())
                    {
                        for (int i = 0; i < (useInnerLoop ? Benchmark.InnerIterationCount : 1); i++)
                        {
                            Utf8String.CodePointReverseEnumerator it = utf8s.CodePoints.GetReverseEnumerator();
                            while (it.MoveNext())
                            {
                                var codePoint = it.Current;
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 public void ReverseEnumerateCodePointsConstructFromByteArray()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 3000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 3000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 300),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 300)
     };
     foreach (TestCase testData in testCases)
     {
         string     s     = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             Utf8String.CodePointReverseEnumerator it = utf8s.CodePoints.GetReverseEnumerator();
             while (it.MoveNext())
             {
                 UnicodeCodePoint codePoint = it.Current;
             }
         }
         PrintTime(testData);
     }
 }
コード例 #3
0
        public unsafe void IndexOfNonOccuringSingleCodePointConstructFromSpan()
        {
            TestCase[] testCases = new TestCase[] {
                new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 5000000),
                new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 5000000),
                new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 500),
                new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 500)
            };
            foreach (TestCase testData in testCases)
            {
                string     s     = testData.String;
                Utf8String utf8s = new Utf8String(s);
                fixed(byte *bytes = utf8s.CopyBytes())
                {
                    utf8s = new Utf8String(new Span <byte>(bytes, utf8s.Length));
                    int iterations = testData.Iterations;

                    _timer.Restart();
                    while (iterations-- != 0)
                    {
                        int p = utf8s.IndexOf(31);
                    }
                    PrintTime(testData);
                }
            }
        }
コード例 #4
0
        public unsafe void EnumerateCodeUnitsConstructFromSpan()
        {
            TestCase[] testCases = new TestCase[] {
                new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 30000000),
                new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 30000000),
                new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 10000),
                new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 3000)
            };
            foreach (TestCase testData in testCases)
            {
                string     s     = testData.String;
                Utf8String utf8s = new Utf8String(s);
                fixed(byte *bytes = utf8s.CopyBytes())
                {
                    utf8s = new Utf8String(new Span <byte>(bytes, utf8s.Length));
                    int iterations = testData.Iterations;

                    _timer.Restart();
                    while (iterations-- != 0)
                    {
                        foreach (byte codeUnit in utf8s)
                        {
                        }
                    }
                    PrintTime(testData);
                }
            }
        }
コード例 #5
0
        public unsafe void ReverseEnumerateCodePointsConstructFromSpan()
        {
            TestCase[] testCases = new TestCase[] {
                new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 3000000),
                new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 3000000),
                new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 300),
                new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 300)
            };
            foreach (TestCase testData in testCases)
            {
                string     s     = testData.String;
                Utf8String utf8s = new Utf8String(s);
                fixed(byte *bytes = utf8s.CopyBytes())
                {
                    utf8s = new Utf8String(new Span <byte>(bytes, utf8s.Length));
                    int iterations = testData.Iterations;

                    _timer.Restart();
                    while (iterations-- != 0)
                    {
                        Utf8String.CodePointReverseEnumerator it = utf8s.CodePoints.GetReverseEnumerator();
                        while (it.MoveNext())
                        {
                            var codePoint = it.Current;
                        }
                    }
                    PrintTime(testData);
                }
            }
        }
コード例 #6
0
        public unsafe void SubstringTrimOneCharacterOnEachSideConstructFromSpan()
        {
            TestCase[] testCases = new TestCase[] {
                new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 50000000),
                new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 50000000),
                new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 50000000),
                new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 50000000)
            };
            foreach (TestCase testData in testCases)
            {
                string     s     = testData.String;
                Utf8String utf8s = new Utf8String(s);
                fixed(byte *bytes = utf8s.CopyBytes())
                {
                    utf8s = new Utf8String(new Span <byte>(bytes, utf8s.Length));
                    int iterations = testData.Iterations;

                    _timer.Restart();
                    while (iterations-- != 0)
                    {
                        Utf8String result = utf8s.Substring(1, utf8s.Length - 2);
                    }
                    PrintTime(testData);
                }
            }
        }
コード例 #7
0
        public void SubstringTrimOneCharacterOnEachSideConstructFromByteArray(int length, int minCodePoint, int maxCodePoint, string description, bool useInnerLoop = false)
        {
            string     s     = GetRandomString(length, minCodePoint, maxCodePoint);
            Utf8String utf8s = new Utf8String(s);

            utf8s = new Utf8String(utf8s.CopyBytes());
            foreach (var iteration in Benchmark.Iterations)
            {
                using (iteration.StartMeasurement())
                {
                    for (int i = 0; i < (useInnerLoop ? Benchmark.InnerIterationCount : 1); i++)
                    {
                        Utf8String result = utf8s.Substring(1, utf8s.Length - 2);
                    }
                }
            }
        }
コード例 #8
0
        public void CodePointEnumeratorsTests(string s)
        {
            Utf8String u8s = new Utf8String(s);
            TestCodePointForwardEnumerator(s, u8s);
            TestCodePointReverseEnumerator(s, u8s);

            byte[] bytes = u8s.CopyBytes();
            unsafe
            {
                fixed (byte* pinnedBytes = bytes)
                {
                    Utf8String u8sFromBytePointer = new Utf8String(new Span<byte>(pinnedBytes, u8s.Length));
                    TestCodePointForwardEnumerator(s, u8sFromBytePointer);
                    TestCodePointReverseEnumerator(s, u8sFromBytePointer);
                }
            }
        }
コード例 #9
0
ファイル: RandomTests.cs プロジェクト: powercode/corefxlab
        public void CodePointEnumeratorsTests(string s)
        {
            Utf8String u8s = new Utf8String(s);
            TestCodePointForwardEnumerator(s, u8s);
            TestCodePointReverseEnumerator(s, u8s);

            byte[] bytes = u8s.CopyBytes();
            unsafe
            {
                fixed (byte* pinnedBytes = bytes)
                {
                    Utf8String u8sFromBytePointer = new Utf8String(new Span<byte>(pinnedBytes, u8s.Length));
                    TestCodePointForwardEnumerator(s, u8sFromBytePointer);
                    TestCodePointReverseEnumerator(s, u8sFromBytePointer);
                }
            }
        }
コード例 #10
0
 public void EnumerateCodePointsConstructFromByteArray()
 {
     foreach (StringWithDescription testData in StringsWithDescription())
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             foreach (UnicodeCodePoint codePoint in utf8s.CodePoints)
             {
             }
         }
         PrintTime(testData);
     }
 }
コード例 #11
0
        public void IndexOfNonOccuringSingleCodePointConstructFromByteArray(int length, int minCodePoint, int maxCodePoint, string description, bool useInnerLoop = false)
        {
            string     s     = GetRandomString(length, minCodePoint, maxCodePoint);
            Utf8String utf8s = new Utf8String(s);

            utf8s = new Utf8String(utf8s.CopyBytes());

            foreach (var iteration in Benchmark.Iterations)
            {
                using (iteration.StartMeasurement())
                {
                    for (int i = 0; i < (useInnerLoop ? Benchmark.InnerIterationCount : 1); i++)
                    {
                        int p = utf8s.IndexOf(31);
                    }
                }
            }
        }
コード例 #12
0
        public void EnumerateCodeUnitsConstructFromByteArray(int length, int minCodePoint, int maxCodePoint, string description, bool useInnerLoop = false)
        {
            string     s     = GetRandomString(length, minCodePoint, maxCodePoint);
            Utf8String utf8s = new Utf8String(s);

            utf8s = new Utf8String(utf8s.CopyBytes());

            foreach (var iteration in Benchmark.Iterations)
            {
                using (iteration.StartMeasurement())
                {
                    for (int i = 0; i < (useInnerLoop ? Benchmark.InnerIterationCount : 1); i++)
                    {
                        foreach (byte codeUnit in utf8s)
                        {
                        }
                    }
                }
            }
        }
コード例 #13
0
        public unsafe void IndexOfNonOccuringSingleCodeUnitConstructFromSpan(int length, int minCodePoint, int maxCodePoint, string description, bool useInnerLoop = false)
        {
            string     s     = GetRandomString(length, minCodePoint, maxCodePoint);
            Utf8String utf8s = new Utf8String(s);

            fixed(byte *bytes = utf8s.CopyBytes())
            {
                utf8s = new Utf8String(new Span <byte>(bytes, utf8s.Length));

                foreach (var iteration in Benchmark.Iterations)
                {
                    using (iteration.StartMeasurement())
                    {
                        for (int i = 0; i < (useInnerLoop ? Benchmark.InnerIterationCount : 1); i++)
                        {
                            int p = utf8s.IndexOf((byte)31);
                        }
                    }
                }
            }
        }
コード例 #14
0
 public void IndexOfNonOccuringSingleCodeUnitConstructFromByteArray()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 30000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 30000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 3000),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 3000)
     };
     foreach (TestCase testData in testCases)
     {
         string     s     = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             int p = utf8s.IndexOf((byte)31);
         }
         PrintTime(testData);
     }
 }
コード例 #15
0
 public void EnumerateCodePointsConstructFromByteArray()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 5000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 5000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 500),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 500)
     };
     foreach (TestCase testData in testCases)
     {
         string     s     = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             foreach (var codePoint in utf8s.CodePoints)
             {
             }
         }
         PrintTime(testData);
     }
 }
コード例 #16
0
 public void IndexOfNonOccuringSingleCodeUnitConstructFromByteArray()
 {
     foreach (StringWithDescription testData in StringsWithDescription())
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             int p = utf8s.IndexOf((Utf8CodeUnit)31);
         }
         PrintTime(testData);
     }
 }
コード例 #17
0
 public unsafe void IndexOfNonOccuringSingleCodeUnitConstructFromSpan()
 {
     foreach (StringWithDescription testData in StringsWithDescription())
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new ByteSpan(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 int p = utf8s.IndexOf((Utf8CodeUnit)31);
             }
             PrintTime(testData);
         }
     }
 }
コード例 #18
0
 public void ReverseEnumerateCodePointsConstructFromByteArray()
 {
     foreach (StringWithDescription testData in StringsWithDescription())
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             Utf8String.CodePointReverseEnumerator it = utf8s.CodePoints.GetReverseEnumerator();
             while (it.MoveNext())
             {
                 UnicodeCodePoint codePoint = it.Current;
             }
         }
         PrintTime(testData);
     }
 }
コード例 #19
0
 public unsafe void ReverseEnumerateCodePointsConstructFromSpan()
 {
     foreach (StringWithDescription testData in StringsWithDescription())
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new ByteSpan(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 Utf8String.CodePointReverseEnumerator it = utf8s.CodePoints.GetReverseEnumerator();
                 while (it.MoveNext())
                 {
                     UnicodeCodePoint codePoint = it.Current;
                 }
             }
             PrintTime(testData);
         }
     }
 }
コード例 #20
0
 public unsafe void SubstringTrimOneCharacterOnEachSideConstructFromSpan()
 {
     foreach (StringWithDescription testData in StringsWithDescription())
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new ByteSpan(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 Utf8String result = utf8s.Substring(1, utf8s.Length - 2);
             }
             PrintTime(testData);
         }
     }
 }
コード例 #21
0
 public void EnumerateCodeUnitsConstructFromByteArray()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 30000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 30000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 10000),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 3000)
     };
     foreach (TestCase testData in testCases)
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             foreach (byte codeUnit in utf8s)
             {
             }
         }
         PrintTime(testData);
     }
 }
コード例 #22
0
 public unsafe void IndexOfNonOccuringSingleCodePointConstructFromSpan()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 5000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 5000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 500),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 500)
     };
     foreach (TestCase testData in testCases)
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new Span<byte>(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 int p = utf8s.IndexOf((UnicodeCodePoint)31);
             }
             PrintTime(testData);
         }
     }
 }
コード例 #23
0
 public void IndexOfNonOccuringSingleCodeUnitConstructFromByteArray()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 30000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 30000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 3000),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 3000)
     };
     foreach (TestCase testData in testCases)
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         utf8s = new Utf8String(utf8s.CopyBytes());
         int iterations = testData.Iterations;
         _timer.Restart();
         while (iterations-- != 0)
         {
             int p = utf8s.IndexOf((byte)31);
         }
         PrintTime(testData);
     }
 }
コード例 #24
0
 public unsafe void SubstringTrimOneCharacterOnEachSideConstructFromSpan()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 50000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 50000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 50000000),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 50000000)
     };
     foreach (TestCase testData in testCases)
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new Span<byte>(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 Utf8String result = utf8s.Substring(1, utf8s.Length - 2);
             }
             PrintTime(testData);
         }
     }
 }
コード例 #25
0
 public unsafe void ReverseEnumerateCodePointsConstructFromSpan()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 3000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 3000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 300),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 300)
     };
     foreach (TestCase testData in testCases)
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new Span<byte>(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 Utf8String.CodePointReverseEnumerator it = utf8s.CodePoints.GetReverseEnumerator();
                 while (it.MoveNext())
                 {
                     UnicodeCodePoint codePoint = it.Current;
                 }
             }
             PrintTime(testData);
         }
     }
 }
コード例 #26
0
 public void Write(Utf8String value)
 {
     this.Write(value.CopyBytes());
 }
コード例 #27
0
 public unsafe void EnumerateCodePointsConstructFromSpan()
 {
     foreach (StringWithDescription testData in StringsWithDescription())
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new ByteSpan(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 foreach (UnicodeCodePoint codePoint in utf8s.CodePoints)
                 {
                 }
             }
             PrintTime(testData);
         }
     }
 }
コード例 #28
0
ファイル: ParserTests.cs プロジェクト: jkotas/corefxlab
        [InlineData(" !", false, 0, 0, 0)] // invalid character test w/ char < '0'
        public unsafe void ParseBool(string text, bool expectSuccess, int index, bool expectedValue, int expectedBytesConsumed)
        {
		    bool result;
            bool parsedValue;
            int bytesConsumed;
			var utf8String = new Utf8String(text);
			byte[] utf8Bytes = utf8String.CopyBytes();
			ReadOnlySpan<byte> utf8BytesSlice = new ReadOnlySpan<byte>(utf8Bytes);

			// System.String
			result = PrimitiveParser.TryParseBoolean(text, index, 'N', out parsedValue, out bytesConsumed);
            Assert.Equal(expectSuccess, result);
            Assert.Equal(expectedValue, parsedValue);
            Assert.Equal(expectedBytesConsumed, bytesConsumed);

			// Utf8String
			result = PrimitiveParser.TryParseBoolean(utf8String.Substring(index), 'N', out parsedValue, out bytesConsumed);
            Assert.Equal(expectSuccess, result);
            Assert.Equal(expectedValue, parsedValue);
            Assert.Equal(expectedBytesConsumed, bytesConsumed);

			// byte[]
			result = PrimitiveParser.TryParseBoolean(utf8Bytes, index, EncodingData.InvariantUtf8, 'N', out parsedValue, out bytesConsumed);
            Assert.Equal(expectSuccess, result);
            Assert.Equal(expectedValue, parsedValue);
            Assert.Equal(expectedBytesConsumed, bytesConsumed);

			// ReadOnlySpan<byte>
			result = PrimitiveParser.TryParseBoolean(utf8Bytes.Slice(index), EncodingData.InvariantUtf8, 'N', out parsedValue, out bytesConsumed);
            Assert.Equal(expectSuccess, result);
            Assert.Equal(expectedValue, parsedValue);
            Assert.Equal(expectedBytesConsumed, bytesConsumed);

			// byte*
            fixed (byte* arrayPointer = utf8Bytes)
            {
                result = PrimitiveParser.TryParseBoolean(arrayPointer, index, utf8Bytes.Length, EncodingData.InvariantUtf8, 'N',
                    out parsedValue, out bytesConsumed);

                Assert.Equal(expectSuccess, result);
                Assert.Equal(expectedValue, parsedValue);
                Assert.Equal(expectedBytesConsumed, bytesConsumed);
            }
        }
コード例 #29
0
 public unsafe void EnumerateCodeUnitsConstructFromSpan()
 {
     TestCase[] testCases = new TestCase[] {
         new TestCase(GetRandomString(5, 32, 126), "Short ASCII string", 30000000),
         new TestCase(GetRandomString(5, 32, 0xD7FF), "Short string", 30000000),
         new TestCase(GetRandomString(50000, 32, 126), "Long ASCII string", 10000),
         new TestCase(GetRandomString(50000, 32, 0xD7FF), "Long string", 3000)
     };
     foreach (TestCase testData in testCases)
     {
         string s = testData.String;
         Utf8String utf8s = new Utf8String(s);
         fixed (byte* bytes = utf8s.CopyBytes())
         {
             utf8s = new Utf8String(new Span<byte>(bytes, utf8s.Length));
             int iterations = testData.Iterations;
             _timer.Restart();
             while (iterations-- != 0)
             {
                 foreach (Utf8CodeUnit codeUnit in utf8s)
                 {
                 }
             }
             PrintTime(testData);
         }
     }
 }