Skip to content

Commit 85a4723

Browse files
lipchevangularsen
authored andcommitted
Update Program.cs (#708)
Added benchmarks for UnitSystem methods (UnitSystem.SI)
1 parent 0c73d61 commit 85a4723

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

UnitsNet.Benchmark/Program.cs

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public class UnitsNetBenchmarks
1313
[Benchmark]
1414
public Length Constructor() => new Length(3.0, LengthUnit.Meter);
1515

16+
[Benchmark]
17+
public Length Constructor_SI() => new Length(3.0, UnitSystem.SI);
18+
1619
[Benchmark]
1720
public Length FromMethod() => Length.FromMeters(3.0);
1821

@@ -22,9 +25,15 @@ public class UnitsNetBenchmarks
2225
[Benchmark]
2326
public double As() => length.As(LengthUnit.Centimeter);
2427

28+
[Benchmark]
29+
public double As_SI() => length.As(UnitSystem.SI);
30+
2531
[Benchmark]
2632
public Length ToUnit() => length.ToUnit(LengthUnit.Centimeter);
2733

34+
[Benchmark]
35+
public Length ToUnit_SI() => length.ToUnit(UnitSystem.SI);
36+
2837
[Benchmark]
2938
public string ToStringTest() => length.ToString();
3039

@@ -43,6 +52,9 @@ public class UnitsNetBenchmarks
4352
[Benchmark]
4453
public double IQuantity_As() => lengthIQuantity.As(LengthUnit.Centimeter);
4554

55+
[Benchmark]
56+
public double IQuantity_As_SI() => lengthIQuantity.As(UnitSystem.SI);
57+
4658
[Benchmark]
4759
public IQuantity IQuantity_ToUnit() => lengthIQuantity.ToUnit(LengthUnit.Centimeter);
4860

0 commit comments

Comments
 (0)