mirror of
https://github.com/penpot/penpot.git
synced 2026-11-17 07:30:35 +00:00
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
30 lines
1.3 KiB
Clojure
30 lines
1.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.features.selection
|
|
"Feature validation.")
|
|
|
|
(def ^:private diagnostic-features #{"stats" "profile" "profile-macros" "profile-raf"})
|
|
|
|
(defn feature-name?
|
|
"True for a Cargo feature name made of letters, digits, underscores or hyphens."
|
|
[value]
|
|
(and (string? value)
|
|
(boolean (re-matches #"[A-Za-z0-9_-]+" value))))
|
|
|
|
(defn feature-selection
|
|
"Validates measurement feature selection before allocating an attempt.
|
|
Cargo validates functional feature names during the retained build."
|
|
[{:keys [default-features? features]
|
|
:or {default-features? true features []}}]
|
|
(when-not (and (boolean? default-features?) (vector? features)
|
|
(every? feature-name? features))
|
|
(throw (ex-info "invalid Cargo feature selection" {:type ::invalid-features})))
|
|
(when-let [selected (seq (filter diagnostic-features features))]
|
|
(throw (ex-info "measurement builds cannot enable diagnostic Cargo features"
|
|
{:type ::diagnostic-features :features (vec selected)})))
|
|
{:default-features? default-features? :features (vec (sort (distinct features)))})
|