This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-01
Channels
- # 100-days-of-code (2)
- # announcements (3)
- # beginners (95)
- # bitcoin (1)
- # cider (18)
- # cljdoc (9)
- # cljs-dev (8)
- # clojure (55)
- # clojure-austin (1)
- # clojure-berlin (4)
- # clojure-italy (21)
- # clojure-nl (1)
- # clojure-russia (2)
- # clojure-spec (47)
- # clojure-uk (31)
- # clojurescript (19)
- # component (8)
- # cursive (5)
- # data-science (2)
- # datomic (33)
- # emacs (7)
- # events (1)
- # figwheel (8)
- # fulcro (16)
- # graphql (27)
- # hyperfiddle (5)
- # jobs (1)
- # jobs-discuss (85)
- # keechma (7)
- # luminus (11)
- # mount (6)
- # off-topic (23)
- # onyx (1)
- # re-frame (4)
- # shadow-cljs (29)
- # specter (19)
- # tools-deps (11)
- # uncomplicate (3)
I'm worried that this may get a little overzealous and construct all constants on startup which may affect performance on startup similar to clojure. especially with regards to [:h1 {:style {:color "red"}} "hello world"]
hiccup data (eg. reagent
) or even (get-in something [:foo :bar])
smaller constants
also closure is not great at detecting CLJS collections as dead code so it may end up never removing those
I tried a revision that uses delay
and it looks like you still get the perf benefit, at least for
(simple-benchmark [] (special-symbol? 'if) 1000000)
this gave me these speedups (which must be exhibiting some noise because some are faster than the non-delay approach):
V8: 1.45, SpiderMonkey 2.8, JavaScriptCore 2.7, Nashorn 1.2, ChakraCore 2.3, GraalVM 1.5
Wonder if I made a mistake, but that change is here https://github.com/mfikes/clojurescript/commit/ed57dc7cf0dbcf61c26f55a2b662e89f4092cac6If curious, here is the kind of code you get at the call site
var $x$jscomp$inline_881$$ = $cljs$core$cst$0sym$0if$$;
$cljs$core$contains_QMARK_$$($cljs$core$_deref$$($cljs$core$cst$0set$0set_DASH__DASH_1359805939$$), $x$jscomp$inline_881$$);
with the constant table containing
$cljs$core$cst$0set$0set_DASH__DASH_1359805939$$ = new $cljs$core$Delay$$(function() {
return new $cljs$core$PersistentHashSet$$(null, new $cljs$core$PersistentArrayMap$$(null, 24, [$cljs$core$cst$0sym$0_AMPERSAND_$$, "null", $cljs$core$cst$0sym$0case_STAR_$$, "null", ...
...
$cljs$core$cst$0sym$0throw$$,
"null", $cljs$core$cst$0sym$0def$$, "null"], null), null);
})