This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-22
Channels
- # announcements (8)
- # babashka (4)
- # beginners (164)
- # calva (17)
- # cider (30)
- # cljdoc (4)
- # cljs-dev (6)
- # clojure (103)
- # clojure-europe (63)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-portugal (1)
- # clojure-uk (3)
- # clojured (10)
- # clojuredesign-podcast (2)
- # clojurescript (16)
- # conjure (2)
- # core-async (9)
- # cursive (26)
- # datalevin (4)
- # datomic (156)
- # gratitude (1)
- # holy-lambda (8)
- # honeysql (9)
- # hoplon (6)
- # off-topic (55)
- # polylith (14)
- # portal (21)
- # reagent (5)
- # reitit (16)
- # releases (3)
- # shadow-cljs (87)
- # spacemacs (3)
- # tools-deps (25)
- # xtdb (9)
Morning!
what google searches bring you: https://www.youtube.com/watch?v=V-PpvOIzz2o
Good morning for an al fresco breakfast
:flag-is:
hmm... a load level of 32 is a bit higher than I want on a 16 core machine. Too much time in kernel
who would have thought removing a bit of arithmetic that was using reflection would lower your execution time from 12-15 minutes to under 3 minutes? (everyone, everyone would have thought that)
@UK0810AQ2 In a next version of clj-kondo maybe satisfies?
can be discouraged via configuration - perhaps you're interested in that? :)
https://github.com/clj-kondo/clj-kondo/issues/996
Does a namespace have Java interop? If so, is it subject to reflection warnings? That could be a nice linter action.
I'm going to have reflection warnings on by default in replacement and have a place for them in data for the forms.
@U04V15CAJ I'm extreme but some of these should be on by default - read string, satisfies and flatten all signal something wrong
@UK0810AQ2 I agree but I want to start with an empty config, we can always add things over time
@U04V15CAJ - yes, eventually 🙂
Probably it's mentioned in @U055NJ5CC’s talk on ClojureTRE called Naked Performance - also @UK0810AQ2 probably can point you to some resources.
@U07FP7QJ0 just read the implementation 😅 It'll make you sweat bullets, it does a lot You can also look here to see the effects https://bsless.github.io/datahike-datalog-parser/ Apologies for the clickbait title, it was a joke, I swear!
clj-kondo has now been released with the new linter config so you can express your concern about satisfies? and any other clojure var to your team members :)
@U04V15CAJ I had to fork the prepl 😢
To get this data
:prepl-output {:tag :err, :val Reflection warning, NO_SOURCE_PATH:1:1 - reference to field toString can't be resolved.
, :user #:replacement.specs.user{:name test-user, :uid uid0}, :input (.toString (identity "foo"))}
:prepl-output {:tag :ret, :val "foo", :ns user, :ms 0, :form ^{:line 1, :column 1} (.toString ^{:line 1, :column 12} (identity "foo")), :user #:replacement.specs.user{:name test-user, :uid uid0}, :input (.toString (identity "foo"))}
It turns out that certain errors are not flushed (ref https://clojure.atlassian.net/browse/CLJ-2645). So the only fix is a fork.
But it means that when one evals a form it's trivial to associate reflection warnings with it. Then, since it's just data, the UI can surface it in any way it likes. It's not done yet but it's on the list.
> @U07FP7QJ0 just read the implementation 😅 Looks like something that could really benefit from some caching
https://ask.clojure.org/index.php/11801/would-make-sense-have-cache-protocol-implementation-lookups
sure, that's always an option, but it would be nice if it did the smart thing by default. There's plenty of prior art for this. Ruby keeps a method cache on the class, which gets invalidated if you reopen the class.
In CLJS there is a cheaper alternative to satisfies?
called implements?
which covers a subset of satisfies
Another alternative (if you're looking for a specific home-made protocol) is to add a method to the protocol that returns true on implementations and false on Object and nil.
I don't think that would help? they both have to go through find-protocol-impl
. It's not specifically satifies?
that's slow, it's find-protocol-impl
which is used in satisfies?
> In CLJS there is a cheaper alternative to satisfies? called implements? which covers a subset of satisfies
ooh interesting, I guess I've seen implements?
but never gave it much thought. I need to look into this.
and one for my "differences between clj and cljs list" which maybe one day will become a blog post
> I don't think that would help?
It would be an alternative to satisfies?
as you're not going through find-protocol-impl anymore (I think)
ohhh so they do cache invocations, just not satisfies?
... even more reason to cache satisifes? as well
A possible answer could be: if you're using satisfies? on a hot path, maybe you shouldn't. Just playing core devil's advocate ;)
One more difference with CLJS is that satisfies?
in CLJS is a macro, so the type argument is static