This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-09
Channels
- # announcements (47)
- # asami (43)
- # babashka (37)
- # beginners (119)
- # bitcoin (1)
- # calva (5)
- # circleci (5)
- # clj-kondo (36)
- # cljs-dev (5)
- # cljsrn (1)
- # clojure (92)
- # clojure-australia (2)
- # clojure-bay-area (2)
- # clojure-europe (121)
- # clojure-italy (7)
- # clojure-japan (1)
- # clojure-nl (4)
- # clojure-serbia (2)
- # clojure-uk (66)
- # clojuredesign-podcast (2)
- # clojurescript (19)
- # conjure (2)
- # cursive (13)
- # data-oriented-programming (2)
- # datomic (53)
- # defnpodcast (7)
- # depstar (33)
- # events (1)
- # fulcro (21)
- # graalvm (47)
- # jobs (1)
- # kaocha (1)
- # lambdaisland (1)
- # luminus (2)
- # malli (14)
- # membrane (16)
- # off-topic (45)
- # polylith (2)
- # re-frame (11)
- # reitit (7)
- # releases (1)
- # reveal (15)
- # rewrite-clj (123)
- # shadow-cljs (7)
- # sql (21)
- # startup-in-a-month (3)
- # tools-deps (25)
- # vim (2)
Hello 👋 We’re currently evaluating asami as our client-side triple store to complement datomic on the server and we’re excited about the durable storage on IndexedDB. It seems `zuko.util` basically brings in all of ClojureScript and has a significant size penalty https://github.com/threatgrid/zuko/blob/961ccaa484b30f28b625e5598b5288cd436f9b3c/src/zuko/util.cljc#L9-L14. Here’s the top offenders from our shadow-cljs build report in our (already pretty bloated) bundle. Is that intentional and required?
When you say that it’s brought in all of ClojureScript, I take it that this is in Clojure, right?
If you do a query with (for instance): [:find ?e :where [:e :type :my-type] [?e :value ?x] [(> ?x 5)]]
Then you’ve called for cljs.core/>
The same goes for any predicate you use. It also applies to bindings like:
[:find ?label :where [:e :type :my-type] [?e :value ?x] [(str "value=" ?x)]]
We actually limit which functions can be called, but that’s done in Asami. It could be done in Zuko to limit the number of things brought into the map
does asami only need those? (def raw-lookup {'= = 'not= not= '< < '> > '<= <= '>= >=}))
we also suspect known-namespaces
might include the same functions several times under different keys (`'cljs.core` , 'clojure.core
, "cljs.core"
, "clojure.core"
)
I’m thinking it might help to take the Asami whitelist and shift it into Zuko. I can’t see any reason why the fn-for
would ever be used in a situation that would require anything that isn’t in that list
ah, asami does have a whitelist? I’m away for a bit now but can take a look later or tomorrow
we tried to be generous with it, so there are some things in there that may seem excessive
We’ve listed the disallowed functions, but they’re not referenced, so I can remove them
great, thanks! I’ll continue on this tomorrow. Another thing I’ll try that should reduce the bundle size is just storing the derefed vars (i.e. functions) instead the whole functions (with docstring etc) in the map. Or do you use that metadata anywhere in asami?
ok, maybe another interesting use case for https://github.com/borkdude/sci, could also be an opt-in thing
for example we’re already using sci in our app, so it would be free in terms of bundle size
sci also has a :allow
and :deny
setting or you can just set {:namespaces {'clojurecore {'-> nil}}}