@@ -77,7 +77,7 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
7777 }
7878
7979
80- [ SimpleJob ( launchCount : 1 , warmupCount : 3 , iterationCount : 3 ) ]
80+ [ SimpleJob ( launchCount : 1 , warmupCount : 5 , iterationCount : 5 ) ]
8181 [ Config ( typeof ( Config ) ) ]
8282 public class RealDataBenchmark
8383 {
@@ -172,6 +172,7 @@ public Config()
172172 public int [ ] DecodedLengths ;
173173 public byte [ ] [ ] output ; // precomputed byte outputs (with correct size)
174174 public byte [ ] [ ] input ; // precomputed byte inputs
175+ public char [ ] [ ] input16 ; // precomputed char inputs
175176
176177
177178 public void RunRuntimeDecodingBenchmarkUTF16 ( string [ ] data , int [ ] lengths )
@@ -261,7 +262,7 @@ public unsafe void RunScalarDecodingBenchmarkUTF16(string[] data, int[] lengths)
261262 for ( int i = 0 ; i < FileContent . Length ; i ++ )
262263 {
263264 string s = FileContent [ i ] ;
264- char [ ] base64 = s . ToCharArray ( ) ;
265+ char [ ] base64 = input16 [ i ] ;
265266 byte [ ] dataoutput = output [ i ] ;
266267 int bytesConsumed = 0 ;
267268 int bytesWritten = 0 ;
@@ -311,18 +312,16 @@ public unsafe void RunSSEDecodingBenchmarkUTF16(string[] data, int[] lengths)
311312 throw new Exception ( "Error" ) ;
312313 }
313314 }
314- }
315-
316-
317-
315+ }
316+
317+
318+
318319 public unsafe void RunSSEDecodingBenchmarkWithAllocUTF8 ( string [ ] data , int [ ] lengths )
319320 {
320321 for ( int i = 0 ; i < FileContent . Length ; i ++ )
321322 {
322- //string s = FileContent[i];
323323 byte [ ] base64 = input [ i ] ;
324324 byte [ ] dataoutput = new byte [ SimdBase64 . Base64 . MaximalBinaryLengthFromBase64Scalar < byte > ( base64 . AsSpan ( ) ) ] ;
325- //byte[] dataoutput = output[i];
326325 int bytesConsumed = 0 ;
327326 int bytesWritten = 0 ;
328327 SimdBase64 . Base64 . DecodeFromBase64SSE ( base64 . AsSpan ( ) , dataoutput , out bytesConsumed , out bytesWritten , false ) ;
@@ -340,7 +339,7 @@ public unsafe void RunSSEDecodingBenchmarkWithAllocUTF16(string[] data, int[] le
340339 for ( int i = 0 ; i < FileContent . Length ; i ++ )
341340 {
342341 string s = FileContent [ i ] ;
343- char [ ] base64 = s . ToCharArray ( ) ;
342+ char [ ] base64 = input16 [ i ] ;
344343 byte [ ] dataoutput = new byte [ SimdBase64 . Base64 . MaximalBinaryLengthFromBase64Scalar < char > ( base64 . AsSpan ( ) ) ] ;
345344 int bytesConsumed = 0 ;
346345 int bytesWritten = 0 ;
@@ -364,11 +363,13 @@ public void Setup()
364363 DecodedLengths = new int [ FileContent . Length ] ;
365364 output = new byte [ FileContent . Length ] [ ] ;
366365 input = new byte [ FileContent . Length ] [ ] ;
366+ input16 = new char [ FileContent . Length ] [ ] ;
367367 for ( int i = 0 ; i < FileContent . Length ; i ++ )
368368 {
369369 DecodedLengths [ i ] = Convert . FromBase64String ( FileContent [ i ] ) . Length ;
370370 output [ i ] = new byte [ DecodedLengths [ i ] ] ;
371371 input [ i ] = Encoding . UTF8 . GetBytes ( FileContent [ i ] ) ;
372+ input16 [ i ] = FileContent [ i ] . ToCharArray ( ) ;
372373 }
373374 }
374375 else if ( FileName == "data/email/" )
@@ -378,13 +379,15 @@ public void Setup()
378379 DecodedLengths = new int [ fileNames . Length ] ;
379380 output = new byte [ FileContent . Length ] [ ] ;
380381 input = new byte [ FileContent . Length ] [ ] ;
382+ input16 = new char [ FileContent . Length ] [ ] ;
381383
382384 for ( int i = 0 ; i < fileNames . Length ; i ++ )
383385 {
384386 FileContent [ i ] = File . ReadAllText ( fileNames [ i ] ) ;
385387 DecodedLengths [ i ] = Convert . FromBase64String ( FileContent [ i ] ) . Length ;
386388 output [ i ] = new byte [ DecodedLengths [ i ] ] ;
387389 input [ i ] = Encoding . UTF8 . GetBytes ( FileContent [ i ] ) ;
390+ input16 [ i ] = FileContent [ i ] . ToCharArray ( ) ;
388391 }
389392
390393 }
0 commit comments