@@ -153,8 +153,8 @@ public Config()
153153 }
154154 // Parameters and variables for real data
155155 [ Params (
156- @"data/email/" // ,
157- // @"data/dns/swedenzonebase.txt"
156+ @"data/email/" ,
157+ @"data/dns/swedenzonebase.txt"
158158 ) ]
159159#pragma warning disable CA1051
160160 public string ? FileName ;
@@ -361,6 +361,26 @@ public unsafe void RunAVX2DecodingBenchmarkUTF8(string[] data, int[] lengths)
361361 }
362362 }
363363
364+
365+ public unsafe void RunOurDecodingBenchmarkUTF8 ( string [ ] data , int [ ] lengths )
366+ {
367+ for ( int i = 0 ; i < FileContent . Length ; i ++ )
368+ {
369+ //string s = FileContent[i];
370+ byte [ ] base64 = input [ i ] ;
371+ byte [ ] dataoutput = output [ i ] ;
372+ int bytesConsumed = 0 ;
373+ int bytesWritten = 0 ;
374+ SimdBase64 . Base64 . DecodeFromBase64 ( base64 . AsSpan ( ) , dataoutput , out bytesConsumed , out bytesWritten , false ) ;
375+ if ( bytesWritten != lengths [ i ] )
376+ {
377+ Console . WriteLine ( $ "Error: { bytesWritten } != { lengths [ i ] } ") ;
378+ #pragma warning disable CA2201
379+ throw new Exception ( "Error" ) ;
380+ }
381+ }
382+ }
383+
364384 public unsafe void RunAVX2DecodingBenchmarkUTF16 ( string [ ] data , int [ ] lengths )
365385 {
366386 for ( int i = 0 ; i < FileContent . Length ; i ++ )
@@ -379,6 +399,24 @@ public unsafe void RunAVX2DecodingBenchmarkUTF16(string[] data, int[] lengths)
379399 }
380400 }
381401 }
402+ public unsafe void RunOurDecodingBenchmarkUTF16 ( string [ ] data , int [ ] lengths )
403+ {
404+ for ( int i = 0 ; i < FileContent . Length ; i ++ )
405+ {
406+ string s = FileContent [ i ] ;
407+ ReadOnlySpan < char > base64 = s . AsSpan ( ) ;
408+ byte [ ] dataoutput = output [ i ] ;
409+ int bytesConsumed = 0 ;
410+ int bytesWritten = 0 ;
411+ SimdBase64 . Base64 . DecodeFromBase64 ( base64 , dataoutput , out bytesConsumed , out bytesWritten , false ) ;
412+ if ( bytesWritten != lengths [ i ] )
413+ {
414+ Console . WriteLine ( $ "Error: { bytesWritten } != { lengths [ i ] } ") ;
415+ #pragma warning disable CA2201
416+ throw new Exception ( "Error" ) ;
417+ }
418+ }
419+ }
382420
383421 public unsafe void RunAVX2DecodingBenchmarkWithAllocUTF8 ( string [ ] data , int [ ] lengths )
384422 {
@@ -418,6 +456,43 @@ public unsafe void RunAVX2DecodingBenchmarkWithAllocUTF16(string[] data, int[] l
418456 }
419457
420458
459+ public unsafe void RunOurDecodingBenchmarkWithAllocUTF8 ( string [ ] data , int [ ] lengths )
460+ {
461+ for ( int i = 0 ; i < FileContent . Length ; i ++ )
462+ {
463+ Span < byte > base64 = input [ i ] . AsSpan ( ) ;
464+ byte [ ] dataoutput = new byte [ SimdBase64 . Scalar . Base64 . MaximalBinaryLengthFromBase64Scalar < byte > ( base64 ) ] ;
465+ int bytesConsumed = 0 ;
466+ int bytesWritten = 0 ;
467+ SimdBase64 . Base64 . DecodeFromBase64 ( base64 , dataoutput , out bytesConsumed , out bytesWritten , false ) ;
468+ if ( bytesWritten != lengths [ i ] )
469+ {
470+ Console . WriteLine ( $ "Error: { bytesWritten } != { lengths [ i ] } ") ;
471+ #pragma warning disable CA2201
472+ throw new Exception ( "Error" ) ;
473+ }
474+ }
475+ }
476+
477+ public unsafe void RunOurDecodingBenchmarkWithAllocUTF16 ( string [ ] data , int [ ] lengths )
478+ {
479+ for ( int i = 0 ; i < FileContent . Length ; i ++ )
480+ {
481+ string s = FileContent [ i ] ;
482+ Span < char > base64 = input16 [ i ] . AsSpan ( ) ;
483+ byte [ ] dataoutput = new byte [ SimdBase64 . Scalar . Base64 . MaximalBinaryLengthFromBase64Scalar < char > ( base64 ) ] ;
484+ int bytesConsumed = 0 ;
485+ int bytesWritten = 0 ;
486+ SimdBase64 . Base64 . DecodeFromBase64 ( base64 , dataoutput , out bytesConsumed , out bytesWritten , false ) ;
487+ if ( bytesWritten != lengths [ i ] )
488+ {
489+ Console . WriteLine ( $ "Error: { bytesWritten } != { lengths [ i ] } ") ;
490+ #pragma warning disable CA2201
491+ throw new Exception ( "Error" ) ;
492+ }
493+ }
494+ }
495+
421496 public unsafe void RunARMDecodingBenchmarkUTF8 ( string [ ] data , int [ ] lengths )
422497 {
423498 for ( int i = 0 ; i < FileContent . Length ; i ++ )
@@ -559,8 +634,8 @@ public unsafe void DotnetRuntimeBase64RealDataUTF16()
559634 RunRuntimeDecodingBenchmarkUTF16 ( FileContent , DecodedLengths ) ;
560635 }
561636
562- [ Benchmark ]
563- [ BenchmarkCategory ( "SSE" ) ]
637+ // [Benchmark]
638+ // [BenchmarkCategory("SSE")]
564639 public unsafe void SSEDecodingRealDataUTF8 ( )
565640 {
566641 RunSSEDecodingBenchmarkUTF8 ( FileContent , DecodedLengths ) ;
@@ -573,13 +648,21 @@ public unsafe void SSEDecodingRealDataWithAllocUTF8()
573648 RunSSEDecodingBenchmarkWithAllocUTF8 ( FileContent , DecodedLengths ) ;
574649 }
575650
576- [ Benchmark ]
577- [ BenchmarkCategory ( "AVX" ) ]
651+ // [Benchmark]
652+ // [BenchmarkCategory("AVX")]
578653 public unsafe void AVX2DecodingRealDataUTF8 ( )
579654 {
580655 RunAVX2DecodingBenchmarkUTF8 ( FileContent , DecodedLengths ) ;
581656 }
582657
658+ [ Benchmark ]
659+ [ BenchmarkCategory ( "default" , "runtime" ) ]
660+ public unsafe void SimdBase64DecodingRealDataUTF8 ( )
661+ {
662+ RunOurDecodingBenchmarkUTF8 ( FileContent , DecodedLengths ) ;
663+ }
664+
665+
583666 //[Benchmark]
584667 //[BenchmarkCategory("AVX")]
585668 public unsafe void AVX2DecodingRealDataWithAllocUTF8 ( )
0 commit comments