From fb463349ae24f193b05750cb4c94753a7eb05a66 Mon Sep 17 00:00:00 2001 From: lipchev Date: Thu, 26 Sep 2019 22:02:29 +0300 Subject: [PATCH] Update Program.cs Added benchmarks for UnitSystem methods (UnitSystem.SI) --- UnitsNet.Benchmark/Program.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/UnitsNet.Benchmark/Program.cs b/UnitsNet.Benchmark/Program.cs index a8a2a8d028..d51d42b653 100644 --- a/UnitsNet.Benchmark/Program.cs +++ b/UnitsNet.Benchmark/Program.cs @@ -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); @@ -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(); @@ -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);