diff_bench

diff_bench holds differential correctness and performance benchmarks for Luna-Flow MoonBit packages. Each benchmark runs two decimal libraries on the same inputs, checks both against an independent BigInt oracle, and measures them with Mare Mark only where the results are right. The subject on the Luna-Flow side is floating’s decimal_gda package.

The repository is a GitHub-only reference project. It is not published on mooncakes and is not meant as a runtime dependency.

Packages

PackageRoleAPITutorialDesign
diff_bench (root)template placeholderAPItutorialdesign
dzmingli_vs_floatingDzmingLi/decimal@0.2.2 versus floating GDA, exact oracle, 19 operationsAPItutorialdesign
dzmingli_vs_floating/benchscaling executable, 1 to 20,000 digitsAPItutorialdesign
dzmingli_vs_floating/bench_commoncommon-digit executable, 1 to 28 digitsAPItutorialdesign
floating_vs_decmial_xmoonbitlang/x/decimal versus floating GDA, two semantic groupsAPItutorialdesign
floating_vs_decmial_x/benchscaling executable, 1 to 4,096 digitsAPItutorialdesign
floating_vs_decmial_x/bench_commoncommon-digit executable, 1 to 28 digitsAPItutorialdesign

The performance chapter reports the measured results of both comparisons (DzmingLi, X).

Reading paths

First time here. Read the dzmingli_vs_floating tutorial: it checks one division against the oracle in a dozen lines and then reproduces the published run.

Reading the results. Start with the performance pages, then the design pages for what the numbers mean: the precision contract, the paired statistics and the semantic groups of the X comparison.

Contributing. Read both design pages, then the contribution guidelines. A new operation needs an oracle rule, a precision bound with a proof, and a test before it is timed.

Method in one paragraph

Every input is materialized from a fixed seed into a neutral decimal (c,s)↦c⋅10−s(c, s) \mapsto c \cdot 10^{-s}, converted to each library outside timing, and computed at a precision that provably holds the exact result. Results are canonicalized and compared with the oracle by exact equality. Timed samples of the two libraries are paired by dataset, repetition and block, and summarized by medians.

Artifacts and tools

Raw JSONL records, HTML reports, Plot IR and the PNG, PDF and SVG figures are kept under artifacts/<package>/, outside the manual. The tools/ directory holds the Python figure layouts (plot_dzmingli_benchmark.py, plot_dzmingli_supplementary_benchmark.py, layout_x_decimal.py, sharing mare_plot_ir.py) and the official decTest audit (run_dzmingli_dectest_audit.sh).

Toolchain

The code targets MoonBit moonc 0.10 or later with the moon.mod and moon.pkg manifests. The library packages build on every target; the executables and the asynchronous Mare Mark runs need native (the async runner also works on js). Published measurements are native release runs.

moon check --target all
moon test --target native

On native and js one test fails: division precision follows the requested semantic contract expects 4097, a value recorded on wasm-gc, where BigInt::from_string in moonbitlang/core misparses long inputs. The correct value is 4099; see the floating_vs_decmial_x design.