1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using Microsoft.Xunit.Performance;
6 
7 namespace System.Tests
8 {
9     public class Perf_Boolean
10     {
11         [Benchmark]
Parse_str()12         public void Parse_str()
13         {
14             foreach (var iteration in Benchmark.Iterations)
15                 using (iteration.StartMeasurement())
16                     for (int i = 0; i < 10000; i++)
17                     {
18                         bool.Parse("True"); bool.Parse("True"); bool.Parse("True");
19                         bool.Parse("True"); bool.Parse("True"); bool.Parse("True");
20                         bool.Parse("True"); bool.Parse("True"); bool.Parse("True");
21                     }
22         }
23 
24         [Benchmark]
ToString_()25         public void ToString_()
26         {
27             bool boo = true;
28             foreach (var iteration in Benchmark.Iterations)
29                 using (iteration.StartMeasurement())
30                     for (int i = 0; i < 10000; i++)
31                     {
32                         boo.ToString(); boo.ToString(); boo.ToString();
33                         boo.ToString(); boo.ToString(); boo.ToString();
34                         boo.ToString(); boo.ToString(); boo.ToString();
35                     }
36         }
37     }
38 }
39