This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-12
Channels
- # aleph (5)
- # announcements (1)
- # asami (29)
- # babashka (2)
- # beginners (36)
- # biff (1)
- # cider (6)
- # clj-kondo (29)
- # clj-together (5)
- # clojars (21)
- # clojure (11)
- # clojure-austin (5)
- # clojure-czech (1)
- # clojure-europe (23)
- # clojure-hk (1)
- # clojure-italy (1)
- # clojure-nl (1)
- # clojure-uk (1)
- # clojurescript (38)
- # clojurewerkz (1)
- # cursive (10)
- # data-science (2)
- # datalevin (15)
- # datomic (8)
- # duct (5)
- # emacs (36)
- # events (4)
- # fulcro (7)
- # garden (1)
- # gratitude (1)
- # interop (4)
- # introduce-yourself (1)
- # leiningen (1)
- # missionary (3)
- # music (3)
- # nbb (4)
- # off-topic (21)
- # polylith (6)
- # remote-jobs (5)
- # shadow-cljs (19)
- # specter (4)
- # xtdb (4)
FWIW I changed it so idents are their own type. wanted to do that for a while, so I guess it was time before people actually start using this 😉
It's probably not supported right now, but could it theoretically be supported that the build report shows the function size too, so I know where to look if I want to optimize something for size?
the way I typically look for thing for optimize is running a release build with --pseudo-names
and then going over the generating sources. it is fairly easy to identify large chunks and associating them with their respective sources
a test build with :modules
may also help. so :modules {:code {:entries [cljs.core]} :target {:entries [the.namespace] :depends-on #{:core}}
My issue is that in SCI I'm re-implementing macros as normal functions: e.g.:
(defn foo [_ _ body] `(do ~@body))
Contrived example: ^
But the backtick generates a lot of code that could be more optimal/smaller. So I'm going through various macros now to manually rewrite it to get rid of the backtick. This is where my question comes from.
Yeah, inspecting the generated code already helps, this is how I first learned about this bloat :)This is what you see in the outputted JS:
user=> '`(do ~@body)
(clojure.core/seq (clojure.core/concat (clojure.core/list (quote do)) body))
(the JS equivalent of those)
Manually writing that as:
user=> '(list* 'do body)
(list* (quote do) body)
yields smaller code. I notice this by re-running the build report.I mean yes, the concat/seq stuff is not ideal but in the end that is only a small part no?