the first optimization round
.NET Test / .NET tests (push) Successful in 1m26s

This commit is contained in:
2026-09-14 13:58:04 +04:00
parent cb2524980d
commit 08036a31d5
12 changed files with 1316 additions and 49 deletions
+8 -20
View File
@@ -133,7 +133,7 @@ bool success = DoubleDouble.TryParse("1.25e-2".AsSpan(), CultureInfo.InvariantCu
The planned `PreciseMath` static class and its `Abs`, `Sqrt`, `Pow`, `Exp`, and
`Log` functions are not implemented. Generic-math interfaces beyond `ISignedNumber`,
additional text formats/general round-trip formatting, and broader performance
additional text formats/general round-trip formatting, and non-arithmetic performance
benchmarks remain deferred.
Replacing allocating arithmetic boundary fallbacks is also deferred; the current
`BigInteger` paths remain in place. That optimization does not require removing
@@ -156,18 +156,9 @@ on CI workflow runs.
## Benchmarks
The BenchmarkDotNet suite compares same-type `+`, `-`, `*`, and `/` operations for
`DoubleDouble`, `decimal`, and `double`: 12 methods with two input cases each.
Each operation/input group uses `double` as its baseline and reports allocations.
Operands are stored in fields and results are returned to the harness; conversions
and construction happen in setup, outside the timed methods.
The left inputs are `1.25` (binary-exact) and `1.1` (a nonzero low component in
`DoubleDouble`); the right input is `0.75`. Decimal and double-double inputs originate
from the same decimal values, while `double` rounds to binary64. These types have
different precision and range contracts: this is a cost comparison, not an accuracy
test. Exceptional values, exponent-boundary fallbacks, mixed-type operators,
conversions, parsing, and formatting are not benchmarked yet.
BenchmarkDotNet measures arithmetic throughput, dependent-chain latency, and allocations,
including comparisons of `DoubleDouble`, `decimal`, and `double`, mixed scalar operations,
and exponent-boundary paths. These are performance measurements, not accuracy tests.
After the Release build above, run from the repository root:
@@ -175,19 +166,16 @@ After the Release build above, run from the repository root:
# Discover benchmark methods without running them.
dotnet run --project 2-benchmarks/Just.PreciseMath.Benchmarks -c Release --no-build -- --list flat
# Quick execution check (also run in CI); not useful for timing comparisons.
# Smoke test; Dry timings are not performance measurements.
dotnet run --project 2-benchmarks/Just.PreciseMath.Benchmarks -c Release --no-build -- --job Dry --filter '*'
# Full measurement run; optionally select an operation with --anyCategories Addition.
# Full measurement run.
dotnet run --project 2-benchmarks/Just.PreciseMath.Benchmarks -c Release --no-build -- --filter '*'
```
Reports are written under the ignored `BenchmarkDotNet.Artifacts/` directory.
Empty selections and failed benchmark runs return a nonzero exit code. CI only
checks execution, with no performance gate. Use full runs on an idle, controlled
machine for comparisons; a scalar `double` operation may approach harness overhead,
so inspect BenchmarkDotNet warnings before interpreting ratios. Do not compare
coverage-instrumented runs or treat Dry-job timings as performance measurements.
Replace `'*'` with a benchmark-name pattern to select a subset; use `--artifacts <path>`
to keep runs separate. Run measurements on an idle machine and inspect BenchmarkDotNet warnings.
## Project structure