From 735877756d6d490c439a21091d4e8d7ee0273fb4 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 22 Apr 2026 22:00:29 +0000 Subject: [PATCH] :zap: Optimize set-shape-svg-attrs by removing redundant operations - Remove backward compatibility for kebab-case SVG attribute keys (fill-rule, stroke-linecap, stroke-linejoin) since svg-attrs are already normalized to camelCase by the attrs->props migration. - Remove unnecessary select-keys filtering and intermediate map construction (dissoc :style + merge style). - Directly extract values from style and attrs using or, avoiding any intermediate map allocation. Signed-off-by: Andrey Antukh --- frontend/src/app/render_wasm/api.cljs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index a6b402f8fd..f18ad9c747 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -571,16 +571,10 @@ (defn set-shape-svg-attrs [attrs] (let [style (:style attrs) - ;; Filter to only supported attributes - allowed-keys #{:fill :fillRule :fill-rule :strokeLinecap :stroke-linecap :strokeLinejoin :stroke-linejoin} - attrs (-> attrs - (dissoc :style) - (merge style) - (select-keys allowed-keys)) - fill-rule (-> (or (:fill-rule attrs) (:fillRule attrs)) sr/translate-fill-rule) - stroke-linecap (-> (or (:stroke-linecap attrs) (:strokeLinecap attrs)) sr/translate-stroke-linecap) - stroke-linejoin (-> (or (:stroke-linejoin attrs) (:strokeLinejoin attrs)) sr/translate-stroke-linejoin) - fill-none (= "none" (-> attrs :fill))] + fill-rule (-> (or (:fillRule style) (:fillRule attrs)) sr/translate-fill-rule) + stroke-linecap (-> (or (:strokeLinecap style) (:strokeLinecap attrs)) sr/translate-stroke-linecap) + stroke-linejoin (-> (or (:strokeLinejoin style) (:strokeLinejoin attrs)) sr/translate-stroke-linejoin) + fill-none (= "none" (or (:fill style) (:fill attrs)))] (h/call wasm/internal-module "_set_shape_svg_attrs" fill-rule stroke-linecap stroke-linejoin fill-none))) (defn set-shape-path-content