Miguel de Benito Delgado 756541939a
🔧 Add renderer benchmark runner (#12756)
Add a CLI under frontend/performance/benches/render_wasm that builds the
renderer, runs seeded scenes (rects, plus, paths, masks) in headless
Chromium and saves per-case timings.

- build, run: prepare or reuse builds; measure cases with warmups,
  repetitions, deadlines
- ab: build and compare Cargo feature configurations
- compare, merge: median changes with bootstrap CIs between saved runs,
  guarded by scene, build and settings checks
- purge: delete managed builds, runs or comparisons
- GPU runs through `run-devenv --gpu`

Lint, format and pnpm scripts now cover performance/ and its tests.

AI-assisted-by: gpt-6.1-sol, deepseek-flash, muse-spark, glm-5.3, gpt6-astra, claude-5.5-sonnet, claude-haiku-5.5
2026-11-12 11:02:34 +01:00

60 lines
2.3 KiB
Clojure

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS SUBSIDIARY SL
(ns benches.render-wasm.scenes.masks
"Fixed grid of masked groups with circle masks and ordered descendants."
(:require
[benches.render-wasm.builder :as sb]
[benches.render-wasm.declarations :as decl]
[benches.render-wasm.runtime.camera :as camera]))
(def ^:const ^:private default-params
{:width 1920 :height 1080})
(def ^:const ^:private schema:params
[:map {:closed true}
[:width [:int {:min 1920}]]
[:height [:int {:min 1080}]]])
(decl/defscene :masks
{:description "Twenty-four circle masks with ordered striped descendants"
:params-schema schema:params}
[params]
(let [params (merge default-params params)]
(sb/scene {:seed (:seed params)
:root {:x 0 :y 0 :width (:width params) :height (:height params)}}
(doseq [i (range 24)]
(let [x (+ 25 (* 310 (mod i 6)))
y (+ 25 (* 255 (quot i 6)))]
(sb/group [:mask i] {:masked-group true}
(sb/circle {:x x :y y :width 180 :height 180
:fills [{:fill-color "#ffffff"}]})
(doseq [j (range 8)]
(sb/rect {:x (+ x (* 28 j) -22)
:y (- y 12)
:width 25
:height 205
:fills [{:fill-color (if (even? j) "#1254b8" "#ff8b38")}]}))))))))
(def ^:const ^:private base-view {:scale 1 :x 0 :y 0})
(decl/defcase :masks/load
{:params default-params :view base-view :context :fresh :preparation {:render :none}}
[rtx]
(camera/load* rtx))
(decl/defcase :masks/pan
{:params default-params :view base-view :context :reuse
:reset #(camera/restore % (get-in % [:case :view]))}
[rtx]
(camera/pan* rtx {:steps 20 :dx 120 :dy 40 :settle-ms 100}))
(decl/defcase :masks/zoom
{:params default-params :view base-view :context :reuse
:reset #(camera/restore % (get-in % [:case :view]))}
[rtx]
(camera/zoom* rtx {:steps 20 :factor 1.6 :settle-ms 100}))