Skip to content

Commit

Permalink
Update Program.cs (#708)
Browse files Browse the repository at this point in the history
Added benchmarks for UnitSystem methods (UnitSystem.SI)
  • Loading branch information
lipchev authored and angularsen committed Sep 27, 2019
1 parent 0c73d61 commit 85a4723
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions UnitsNet.Benchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public class UnitsNetBenchmarks
[Benchmark]
public Length Constructor() => new Length(3.0, LengthUnit.Meter);

[Benchmark]
public Length Constructor_SI() => new Length(3.0, UnitSystem.SI);

[Benchmark]
public Length FromMethod() => Length.FromMeters(3.0);

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

[Benchmark]
public double As_SI() => length.As(UnitSystem.SI);

[Benchmark]
public Length ToUnit() => length.ToUnit(LengthUnit.Centimeter);

[Benchmark]
public Length ToUnit_SI() => length.ToUnit(UnitSystem.SI);

[Benchmark]
public string ToStringTest() => length.ToString();

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

[Benchmark]
public double IQuantity_As_SI() => lengthIQuantity.As(UnitSystem.SI);

[Benchmark]
public IQuantity IQuantity_ToUnit() => lengthIQuantity.ToUnit(LengthUnit.Centimeter);

Expand Down

0 comments on commit 85a4723

Please sign in to comment.