This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-25
Channels
- # announcements (5)
- # babashka (23)
- # beginners (70)
- # cider (24)
- # clj-kondo (14)
- # cljsrn (2)
- # clojars (6)
- # clojure (195)
- # clojure-australia (1)
- # clojure-dev (2)
- # clojure-europe (27)
- # clojure-france (1)
- # clojure-nl (4)
- # clojure-norway (2)
- # clojure-spec (2)
- # clojure-uk (12)
- # clojurescript (3)
- # clojurewerkz (1)
- # core-async (21)
- # cursive (9)
- # datomic (37)
- # duct (3)
- # emacs (16)
- # events (4)
- # fulcro (34)
- # graalvm (12)
- # javascript (3)
- # jobs (4)
- # malli (1)
- # meander (3)
- # nrepl (1)
- # off-topic (27)
- # pathom (16)
- # re-frame (17)
- # reagent (19)
- # rewrite-clj (18)
- # sci (47)
- # shadow-cljs (179)
- # spacemacs (18)
- # sql (52)
- # tools-deps (80)
- # vim (27)
- # vrac (1)
- # xtdb (9)
By the way, I remember reading something in the Malli channel about trimming the sci build size for CLJS?
One reason is that it adds lots of docstrings you might not need. Another reason is that it holds on to functions you might not need. But that's hard to predict in an interpreter, since you don't know what users want to use
Interesting. The second one makes sense. In my case everything read by SCI is located in EDN file(s)
I'm open to ideas of making a more minimal build through some API. The only condition I have is that it should not affect performance of GraalVM binaries like babashka
I think it would make sense to have some kind of optional build size optimization, which is off by default
I think the idea that ikitommi has is more fine-grained. The namespaces.cljc file contains top-level datastructures with all the core namespaces in it. Those should be lifted into a function and then users can do a select-keys or dissoc on those namespaces, and making a top-level value out of that. That should help.
I've thought about a default setting, but I can't think of a scenario where there's only one default setting that fits all
yes, but that should be an option to the user. e.g.:
(sci.core/add-namespace opts 'clojure.core {:exclude [...]}) or `:include
`
something like thatI wonder if it would work if I took all my EDN files, get all symbols, and just :include
all of that. I assume it wouldn't since those symbol might have dependencies not listed in there?
btw, the build is still a lot smaller than when you go with self-hosted CLJS which is 8 megabytes or so
hi. just prepared malli for dce, users can cut out schemas, from def
to defn
and one top-level def
that can be customized to have the default (all schmas) or an empty registry, which can be customly collected
select-keys
won’t work here, as Closure tracks down things statically, if you call the function that has everything, everything is added.
but, one can create a new map manually, having just the needed key->value mappings and only those will be in.
I think there are two options here. For both: make all the def
defn
s and split them into smaller parts, e.g. clojure-set-bindings
, clojure-walk-bindings
etc. Then, the options:
but the options :):
1. have a global def collecting all int sci.core
and create a new entrypoint, like sci.custom
that doesn’t have the def, but an api that requires the bindings as parameter
2. have a compiler switch (`:closure-defines` / :jvm-opts
) which allow to empty the default registry
3. macro-time select-keys, might work, tested something like this, coudn’t get it to work
didn’t test the syntax, buf something like:
(require '[sci.custom])
(require '[sci.namepaces :as n])
(require '[clojure.walk :as walk])
(def sci-eval
(sci.custom/evaluator
{:bindings (merge (n/cloure-core-bindings)
(n/clojure-set-bindings)
{'walk (n/copy-var clojure.walk/walk...)})})
(sci-eval "(int? 1)")
; => true
also, options not to include docstring via options would be great, would allow tiny sci runtimes.