Skip to content

Add benchmarks for UnitSystem methods - #708

Merged
angularsen merged 1 commit into
angularsen:masterfrom
lipchev:master
Sep 27, 2019
Merged

Add benchmarks for UnitSystem methods#708
angularsen merged 1 commit into
angularsen:masterfrom
lipchev:master

Conversation

@lipchev

Copy link
Copy Markdown
Collaborator

Added benchmarks for UnitSystem methods (UnitSystem.SI) in order to use as base line for comparison (I see there is a tool for that) with the modifications envisioned in #651

Added benchmarks for UnitSystem methods (UnitSystem.SI)
@lipchev

Copy link
Copy Markdown
CollaboratorAuthor

BenchmarkDotNet=v0.11.5, OS=Windows 10.0.17763.737 (1809/October2018Update/Redstone5)
Intel Core i7-7820HQ CPU 2.90GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=3.0.100-preview5-011568
[Host] : .NET Core 2.1.11 (CoreCLR 4.6.27617.04, CoreFX 4.6.27617.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.11 (CoreCLR 4.6.27617.04, CoreFX 4.6.27617.02), 64bit RyuJIT

MethodMeanErrorStdDevMedianGen 0Gen 1Gen 2Allocated
Constructor9.043 ns0.0459 ns0.0429 ns9.049 ns----
Constructor_SI423.813 ns8.2875 ns13.1449 ns415.581 ns0.0453--192 B
FromMethod21.048 ns0.1656 ns0.1549 ns21.083 ns----
ToProperty6.484 ns0.1154 ns0.0963 ns6.452 ns----
As6.298 ns0.1402 ns0.1243 ns6.336 ns----
As_SI404.015 ns6.9181 ns6.1327 ns405.770 ns0.0453--192 B
ToUnit14.556 ns0.0547 ns0.0511 ns14.561 ns----
ToUnit_SI418.968 ns8.6850 ns11.5942 ns414.785 ns0.0453--192 B
ToStringTest1,769.903 ns5.8755 ns5.4959 ns1,770.698 ns0.1965--832 B
Parse45,782.334 ns913.8546 ns2,099.7328 ns45,941.022 ns10.1929--43000 B
TryParseValid43,719.197 ns859.6624 ns1,736.5605 ns43,829.068 ns10.1929--42976 B
TryParseInvalid43,842.192 ns87.9830 ns77.9946 ns43,860.654 ns10.1318--42576 B
QuantityFrom58.498 ns0.6131 ns0.5435 ns58.505 ns0.0132--56 B
IQuantity_As13.341 ns0.2962 ns0.3955 ns13.260 ns0.0057--24 B
IQuantity_As_SI405.592 ns3.8216 ns3.3878 ns406.020 ns0.0453--192 B
IQuantity_ToUnit19.525 ns0.4049 ns0.3788 ns19.683 ns0.0133--56 B
IQuantity_ToStringTest1,712.609 ns11.4083 ns10.1132 ns1,712.467 ns0.1945--832 B

@codecov-io

codecov-io commented Sep 26, 2019

Copy link
Copy Markdown

Codecov Report

Merging #708 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #708 +/- ##
=======================================
Coverage 58.32% 58.32% =======================================
Files 166 166 Lines 37811 37811 =======================================
Hits 22055 22055 Misses 15756 15756

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c73d61...fb46334. Read the comment docs.

@angularsen
angularsen merged commit 85a4723 into angularsen:masterSep 27, 2019
@angularsen

Copy link
Copy Markdown
Owner

Great, thanks!

@lipchev

Copy link
Copy Markdown
CollaboratorAuthor

A quick note: the performance of the SI methods tested in this release are actually dependent on the quantity that is tested; here we test Length- which has ~ 30 UnitInfos (meter being in the middle), where for example VolumePerLength has only 3- thus it seems your result may vary (being slightly lower for most other quantities, on average):

MethodMeanErrorStdDevGen 0Gen 1Gen 2Allocated
Constructor12.29 ns0.2328 ns0.2286 ns----
Constructor_SI_VolumePerLength327.59 ns1.1634 ns1.0883 ns0.0453--192 B
Constructor_SI_Length468.77 ns10.6604 ns14.9444 ns0.0453--192 B

@angularsen

Copy link
Copy Markdown
Owner

Right. I don't recall the exact implementation for looking up the conversion functions from the top of my head, it has changed a few times lately, but I'm sure it can be improved. Maybe as simple as using a dictionary if we are not already using that.

@angularsen

Copy link
Copy Markdown
Owner

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@lipchev@codecov-io@angularsen