This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-30
Channels
- # 100-days-of-code (2)
- # announcements (2)
- # beginners (8)
- # boot (6)
- # calva (52)
- # cider (6)
- # cljs-dev (11)
- # cljsrn (3)
- # clojure (58)
- # clojure-austin (2)
- # clojure-russia (6)
- # clojure-spec (23)
- # clojure-uk (12)
- # clojurescript (29)
- # datomic (10)
- # emacs (1)
- # figwheel (2)
- # figwheel-main (2)
- # fulcro (3)
- # luminus (1)
- # off-topic (38)
- # re-frame (21)
- # ring-swagger (1)
- # robots (1)
- # shadow-cljs (65)
- # spacemacs (3)
- # tools-deps (16)
Curious about an optimization that would detect when OK, and “lift” values. For example, this is a lot faster than the version in core:
(let [special-syms '#{if def fn* do let* loop* letfn* throw try catch finally recur new set! ns deftype* defrecord* . js* & quote case* var ns*}]
(defn special-symbol?
[x]
(contains? special-syms x)))
Oh curious too...in which way? Is a wrapping let faster than a def?
Oh ok yes it makes sense definitely. I actually always have a def for those things so I thought I was missing something
@mfikes https://dev.clojure.org/jira/browse/CLJS-497?focusedCommentId=41986&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-41986 not sure if there ever was a ticket opened for this. if its done for CLJS however I would probably wrap it in a delay and inject a deref since we want to avoid constructing too many things on startup
Right. Maybe even custom JavaScript based on checking for null
to lazily construct. (To try to avoid any overhead associated with Delay
objects.)
Hah. It's nearly trivial to take the stuff we did for ^:const
and use it to detect constant maps, sets, vectors in the code and throw them into the constant table. Doing that, without changing any of the standard lib, causes special-symbol?
to exhibit these speedups under script/simple-benchmark
:
V8: 1.26, SpiderMonkey 2.5, JavaScriptCore 3.2, Nashorn, 2.8, ChakraCore 3.5, GraalVM 1.9
Of course, that doesn't lazily construct them. But, on the other hand it theoretically aliases identical constants into the constant table.
Here is my experimental branch: https://github.com/mfikes/clojurescript/tree/exp-lift-constants