From 502fbeb5bbcc36b9ff577ba1d5e6bf49cd025a47 Mon Sep 17 00:00:00 2001 From: He-Pin Date: Sun, 31 May 2026 01:46:54 +0800 Subject: [PATCH] perf: use commix concurrent GC for Native CLI binary Motivation: The Native CLI defaulted to immix, whose stop-the-world collections dominate wall-clock on allocation-heavy configs and cause large latency variance. Profiling against jrsonnet showed the remaining gap was GC/allocation cost, not interpreter dispatch. Modification: Set nativeGC = "commix" (concurrent immix) on the Native release module. commix collects on background threads, overlapping collection with evaluation. Output is byte-identical and RSS is unchanged vs immix (it still frees -- bounded, safe on small machines). Result: jrsonnet realworld suite (min ms, interleaved, cooled): kube-prometheus 141.8 -> 122.1 (1.16x) loki 43.9 -> 40.5 mimir 51.6 -> 47.6 tempo 45.4 -> 45.7 (neutral) STW variance collapses (kube-prometheus +-55ms -> +-5ms). RSS 168 -> 169 MB. Native test suite 462/462 pass. --- build.mill | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.mill b/build.mill index 58350b72..0e22d492 100644 --- a/build.mill +++ b/build.mill @@ -278,6 +278,12 @@ object sjsonnet extends VersionFileModule { def releaseMode = ReleaseMode.ReleaseFull def nativeLTO = LTO.Full def nativeMultithreading = None + // Concurrent GC: collects on background threads, overlapping collection with + // evaluation. On allocation-heavy configs (jrsonnet realworld suite) this is + // ~13% faster than the default immix and collapses immix's stop-the-world + // latency variance (kube-prometheus ±55ms -> ±5ms), while keeping the same + // RSS (it still frees -- bounded, safe on small machines). Output is identical. + def nativeGC = "commix" // Build aklomp/base64 as a static library for SIMD-accelerated base64. // We pin to a specific upstream commit (no git submodule) and clone on