@@ -14,6 +14,7 @@ namespace PooledStream.Benchmark
14
14
using ObjectMemoryStream = CodeProject . ObjectPool . Specialized . MemoryStreamPool ;
15
15
[ MemoryDiagnoser ]
16
16
[ Config ( typeof ( MultiPlatformConfig ) ) ]
17
+ // [DisassemblyDiagnoser(printIL: true, printSource: true, printAsm: true)]
17
18
public class StreamBenchmark
18
19
{
19
20
[ Params ( 100 , 1_000 , 50_000 ) ]
@@ -40,9 +41,10 @@ public void PooledStreamBench()
40
41
{
41
42
using ( var stm = new PooledMemoryStream ( ArrayPool < byte > . Shared , DataSize ) )
42
43
{
43
- stm . Write ( data , 0 , data . Length ) ;
44
+ stm . Write ( data , 0 , DataSize ) ;
44
45
}
45
46
}
47
+ // ArrayPool<byte>.Shared.Return(data);
46
48
}
47
49
[ Benchmark ]
48
50
public void RecyclableStreamTest ( )
@@ -75,22 +77,18 @@ class MultiPlatformConfig : ManualConfig
75
77
{
76
78
public MultiPlatformConfig ( )
77
79
{
78
- Add ( Job . Default . WithWarmupCount ( 3 ) . WithTargetCount ( 3 )
79
- . With ( CsProjCoreToolchain . NetCoreApp20 ) ) ;
80
- Add ( Job . Default . WithWarmupCount ( 3 ) . WithTargetCount ( 3 )
80
+ Add ( Job . Default . WithWarmupCount ( 3 ) . WithIterationCount ( 3 )
81
81
. With ( CsProjCoreToolchain . NetCoreApp21 ) ) ;
82
+ Add ( Job . Default . WithWarmupCount ( 3 ) . WithIterationCount ( 3 )
83
+ . With ( CsProjCoreToolchain . NetCoreApp30 ) ) ;
84
+ this . Options |= ConfigOptions . DisableOptimizationsValidator ;
82
85
}
83
86
}
84
87
class Program
85
88
{
86
89
static void Main ( string [ ] args )
87
90
{
88
- var switcher = new BenchmarkSwitcher ( new Type [ ]
89
- {
90
- typeof ( StreamBenchmark ) ,
91
- typeof ( StreamPrallelBenchmark )
92
- }
93
- ) ;
91
+ var switcher = new BenchmarkSwitcher ( typeof ( Program ) . Assembly ) ;
94
92
switcher . Run ( ) ;
95
93
}
96
94
}
0 commit comments