public void WarmupPool() { // Creating first object will warm pool up. using (var test = new Perf.PoolBoy <Text.RegularExpressions.Regex>()) { using (var regex = new Perf.Text.RegularExpressions.Regex("[0-9]+", poolSize: PoolSize)) { // Access the wrapper object in order to create object pool. var wrapper = regex.wrapperObject; } } }
//[Benchmark] public void BenchmarkPooled() { using (var test = new Perf.PoolBoy <Text.StringBuilder>()) { for (var i = 0; i < Iters; i++) { using (var regex = new Perf.Text.RegularExpressions.Regex("[0-9]+", poolSize: PoolSize)) { for (var x = 0; x < Concats; x++) { regex.IsMatch(stringAllocation); } } } } }