66using BenchmarkDotNet . Attributes ;
77using SixLabors . ImageSharp . PixelFormats ;
88using SixLabors . ImageSharp . Tests ;
9- using CoreSize = SixLabors . ImageSharp . Size ;
109
1110namespace SixLabors . ImageSharp . Benchmarks . Codecs
1211{
13- [ Config ( typeof ( Config . ShortClr ) ) ]
14- public class DecodeFilteredPng : BenchmarkBase
12+ [ Config ( typeof ( Config . ShortMultiFramework ) ) ]
13+ public class DecodeFilteredPng
1514 {
1615 private byte [ ] filter0 ;
1716 private byte [ ] filter1 ;
@@ -30,44 +29,33 @@ public void ReadImages()
3029 }
3130
3231 [ Benchmark ( Baseline = true , Description = "None-filtered PNG file" ) ]
33- public CoreSize PngFilter0 ( )
34- {
35- return LoadPng ( this . filter0 ) ;
36- }
32+ public Size PngFilter0 ( )
33+ => LoadPng ( this . filter0 ) ;
3734
3835 [ Benchmark ( Description = "Sub-filtered PNG file" ) ]
39- public CoreSize PngFilter1 ( )
40- {
41- return LoadPng ( this . filter1 ) ;
42- }
36+ public Size PngFilter1 ( )
37+ => LoadPng ( this . filter1 ) ;
4338
4439 [ Benchmark ( Description = "Up-filtered PNG file" ) ]
45- public CoreSize PngFilter2 ( )
46- {
47- return LoadPng ( this . filter2 ) ;
48- }
40+ public Size PngFilter2 ( )
41+ => LoadPng ( this . filter2 ) ;
4942
5043 [ Benchmark ( Description = "Average-filtered PNG file" ) ]
51- public CoreSize PngFilter3 ( )
52- {
53- return LoadPng ( this . filter3 ) ;
54- }
44+ public Size PngFilter3 ( )
45+ => LoadPng ( this . filter3 ) ;
5546
5647 [ Benchmark ( Description = "Paeth-filtered PNG file" ) ]
57- public CoreSize PngFilter4 ( )
58- {
59- return LoadPng ( this . filter4 ) ;
60- }
48+ public Size PngFilter4 ( )
49+ => LoadPng ( this . filter4 ) ;
6150
6251 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
63- private static CoreSize LoadPng ( byte [ ] bytes )
52+ private static Size LoadPng ( byte [ ] bytes )
6453 {
65- using ( var image = Image . Load < Rgba32 > ( bytes ) )
66- {
67- return image . Size ( ) ;
68- }
54+ using var image = Image . Load < Rgba32 > ( bytes ) ;
55+ return image . Size ( ) ;
6956 }
7057
71- private static string TestImageFullPath ( string path ) => Path . Combine ( TestEnvironment . InputImagesDirectoryFullPath , path ) ;
58+ private static string TestImageFullPath ( string path )
59+ => Path . Combine ( TestEnvironment . InputImagesDirectoryFullPath , path ) ;
7260 }
73- }
61+ }
0 commit comments