OnlyCSharp Micro-Benchmarks

Real steady-state micro-benchmarks from the optimization_agent_loop harness (min-of-3 estimator, xorshift64 inputs, 4096-cycle, TieredCompilation off). This page runs the Mathematics.Fast.Math (OcMath) benchmark group live at build time and renders the measured result tables. Timings are a machine-and-run-dependent snapshot; only OcMath is shown to keep the build bounded. No JavaScript, no WASM.

A. Wrapper overhead (app-used intrinsics): OcMath vs System.Math

MethodVariantns/opops/sNote
Sqrt(double)OcMath.Sqrt3.495286,158,895
Sqrt(double)System.Math.Sqrt3.488286,679,659
Sin(double)OcMath.Sin3.400294,127,163
Sin(double)System.Math.Sin3.344299,001,038
Cos(double)OcMath.Cos3.298303,256,827
Cos(double)System.Math.Cos3.373296,483,410
Pow(double)OcMath.Pow7.394135,251,561
Pow(double)System.Math.Pow7.439134,433,266
Log(double)OcMath.Log2.534394,569,929
Log(double)System.Math.Log2.528395,577,444
Abs(double)OcMath.Abs0.3902,565,457,652
Abs(double)System.Math.Abs0.3572,804,592,801

B. Pure-software app-used helpers (OcMath only)

MethodVariantns/opops/sNote
Clamp(double)OcMath.Clamp0.4122,425,194,864
Lerp(double)OcMath.Lerp0.3572,800,061,601
Max(double)OcMath.Max0.3862,589,586,754
SmoothStep(double)OcMath.SmoothStep0.5171,933,241,311

C. Optimization candidates (current vs proposed vs ns2.1 ceiling)

MethodVariantns/opops/sNote
Log2(double)OcMath.Log2 [Math.Log(x,2)]2.568389,397,485
Log2(double)proposed [Log(x)*Log2E]2.566389,721,486max|Δ| vs current = 0.00E+000
Log2(double)ceiling [Math.Log2 net8]3.650273,967,724
Log2(float)OcMath.Log2 [Log(x)/Log(2f)]2.004498,985,811
Log2(float)proposed [Log(x)*Log2Ef]1.992502,117,681max|Δ| vs current = 0.00E+000
Log2(float)ceiling [MathF.Log2 net8]1.879532,212,140
Exp2(double)OcMath.Exp2 [Pow(2,x)]2.200454,483,480
Exp2(double)proposed [Exp(x*Ln2)]2.103475,549,616max|Δ| vs current = 0.00E+000
Sin+Cos(double)OcMath.Sin+Cos (renderer path)8.857112,909,381
Sin+Cos(double)fused Math.SinCos (net-core)9.588104,295,841blocked by ns2.1 target