From a0ec4225b42073584f38f35aba9564e511b417b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Tejero=20Cantero?= Date: Wed, 2 Sep 2026 00:19:35 +0200 Subject: [PATCH] :wrench: Run the A/B bench at :advanced, now that the corruption is answered The :simple pin existed because datascript's query layer was broken at :advanced under this toolchain, which mirror:ds-advanced-corruption has since answered: shadow-cljs never reads a library's own deps.cljs externs declaration, so the build must name the file itself. :ab-bench therefore runs :advanced with :externs ["datascript/externs.js"], and with :infer-externs :all to match the datahike column, whose build needs it. The default :auto infers externs for a project's own sources and not for a jar. bench.core/-main now exits explicitly. Datahike keeps the node event loop alive after the last reading, and the shared body must stay identical between the two worktrees. Entry: pp:mirror:graph-overlay-experiment AI-assisted-by: opus-5 --- frontend/shadow-cljs.edn | 17 +++++++++++------ frontend/src/bench/core.cljs | 4 +++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/frontend/shadow-cljs.edn b/frontend/shadow-cljs.edn index 5abdef086b..2b43cd93d7 100644 --- a/frontend/shadow-cljs.edn +++ b/frontend/shadow-cljs.edn @@ -166,10 +166,11 @@ {:test {:init-fn frontend-tests.runner/init :prepend-js ";if (typeof globalThis.navigator?.userAgent === 'undefined') { globalThis.navigator = {userAgent: ''}; };"}}} - ;; The A/B bench pins :simple so the two engines are measured under one - ;; compiler configuration; the 2026-08-21 datahike report's V8 table was - ;; read that way. Lifting the pin needs :externs ["datascript/externs.js"] - ;; here, for the reason bench.debug states, and a fresh table. + ;; The A/B bench runs both engines at :advanced under one compiler + ;; configuration, each build naming its own library's externs declaration + ;; because shadow-cljs never reads it from the library's deps.cljs. The + ;; :simple pin this replaces was forced by that unread declaration, and the + ;; 2026-08-21 report's V8 table was read under it. :ab-bench {:target :node-script :output-to "target/ab-bench.js" @@ -177,9 +178,13 @@ :main bench.core/-main :compiler-options - {:optimizations :simple + {:optimizations :advanced :output-wrapper false - :warnings {:fn-deprecated false}}} + :warnings {:fn-deprecated false} + ;; :all, not the default :auto, to match the datahike column: :auto + ;; infers externs for this project's own sources and not for a jar. + :infer-externs :all + :externs ["datascript/externs.js"]}} ;; The gate for mirror:ds-advanced-corruption: bench.debug reads one ;; database six ways and exits non-zero on a wrong answer. Its release diff --git a/frontend/src/bench/core.cljs b/frontend/src/bench/core.cljs index 83f53909a5..2778b652c6 100644 --- a/frontend/src/bench/core.cljs +++ b/frontend/src/bench/core.cljs @@ -77,4 +77,6 @@ :rev-rows rev-rows :desc-rows desc-rows :heap-mb (fmt (/ (.-heapUsed (js/process.memoryUsage)) 1e6))})))) -(defn -main [& _] (run)) +;; Datahike keeps the node event loop alive after the last reading, so the +;; bench exits itself rather than hanging until a timeout kills it. +(defn -main [& _] (run) (js/process.exit 0))