This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-20
Channels
- # announcements (42)
- # babashka (70)
- # beginners (152)
- # chlorine-clover (19)
- # cider (14)
- # clj-kondo (23)
- # clojars (15)
- # clojure (86)
- # clojure-denmark (1)
- # clojure-dev (5)
- # clojure-europe (57)
- # clojure-france (145)
- # clojure-hungary (2)
- # clojure-italy (5)
- # clojure-nl (7)
- # clojure-spec (35)
- # clojure-sweden (2)
- # clojure-uk (58)
- # clojurebridge (1)
- # clojured (1)
- # clojurescript (50)
- # core-typed (9)
- # cursive (10)
- # data-science (11)
- # datascript (4)
- # datomic (25)
- # emacs (8)
- # fulcro (49)
- # graalvm (7)
- # graphql (6)
- # joker (1)
- # juxt (2)
- # kaocha (1)
- # off-topic (22)
- # other-lisps (1)
- # pathom (20)
- # re-frame (3)
- # reagent (11)
- # reitit (2)
- # remote-jobs (1)
- # shadow-cljs (44)
- # spacemacs (2)
- # sql (17)
- # tree-sitter (2)
- # vim (8)
- # vrac (2)
Question: what's the difference between resources/BABASHKA_RELEASED_VERSION and resources/BABASHKA_VERSION? I'm asking because I re-ran the install script to get the new version, but I found I got 0.0.70 again.
@borkdude Out of curiousity, did you consider implementing the Sci interpreter with protocols? I wonder how much of a performance difference that would make (on dispatching). The maps in analyzer.cljc ( {:sci.impl/op :var-value}
) would have to be replaced with (deftype ..)
and the dispatch code in the interpreter.cljc would have to be adapted
I'll leave it for a bit later, need to have some performance issues first. I was wondering if you already had thought about it and found issues with it. Thanks!
I don't use protocols a lot in my daily code. Maybe I should, it just doesn't cross my mind š
yeah makes sense
I use protocols mostly for abstracting interfaces. I like that a lot. I have once seen a huge performance increase in a Hadoop project (long time ago), but for the rest don't use it for performance reasons. I also like it to organize my code and it's less forgiving than map dispatching so it catches errors quicker. Reloading code is not as nice with protocols though, you need to be more careful
that wouldn't be an issue for me, I test a lot of programs with one-off invocations anyway
Ah cool
Ok now I'm thinking about it a protocol implementation could be gradually added (due to the open extention possibility). So I could already start this with minimal effort. Do you have an (automated) performance suite somewhere to see improvements or regressions easily?
One other potential feature would be that protocols make the language open for extension (e.g. custom optimizations)
so, with the latest change to reader conditionals weavejester/medley and lambdaisland/regal can just be ran from their original repos without any changes
@deleted-user You expressed/asked about this idea before: so it's now implemented, no more duplication of the :clj branch for :bb
Works for the jvm test suite, but let's wait for the js suite
it fails for node, probably because Object
isn't a thing there? :default
works in CLJS I think
yeah i was too lazy to look it up, but probably
I'll look at it later. Had an urge to just test this š
Ok js is more complicated. Extending object
works, but I get lot's of other errors (number is not an object apparantly). So a bit more work hehe. To be continued
Wooot node passes https://github.com/borkdude/sci/pull/277 š
My guess is that this already a huge performance boost
for sure, so I'll leave that to someone who has benchmarked Sci before š
simple test:
time ./sci "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
If it's not faster I'll continue until it's faster, my promise
I think the identity implementations should just be umbrella'd under Object
or :default
here's an example: https://github.com/borkdude/finitize/blob/master/src/finitize/core.cljc
could be, I'm not a cljs (protocol) guru
more specifically: https://github.com/borkdude/finitize/blob/62840885886354a5a95b7404f04fe4596c58e75e/src/finitize/core.cljc#L19
Right now I think the current implementation is more optimal because Object follows the heavier eval path now. So maybe better to add later
how do I get the ./sci
binary? I'm using script/perf
now
ah yeah ok, I'll update my Graal setup
for what it's worth the script/perf
doesn't say it's faster
ok not there yet š
ā sci git:(features/protocol-interpreter) ā time ./sci "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
1000000
./sci 1.92s user 0.08s system 99% cpu 2.016 total
ā sci git:(features/protocol-interpreter) ā time ./sci-master "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
1000000
./sci-master 1.67s user 0.08s system 99% cpu 1.767 total
$ time ./sci "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
1000000
./sci 1.83s user 0.08s system 99% cpu 1.919 total
master is around 1.5-1.6sOk challenge accepted š
you can also try to measure "bigger" programs like the one with spartan.spec and s/?
I'll start with optimizing loop
I'll stop promising and start delivering š Talk to you later
Fun: print random docstring: https://github.com/borkdude/babashka/#print-random-docstring
I don't use much editor tooling for bb myself, because the scripts already start so fast, but it's cool that it's there for those who want it
No luck on the protocol test š All my trials were slower or broke the functionality
true š I think i would have to understand the analyzer part better and probably make some (big) changes there to make it work with protocols. Maybe I'll try later again
how it works in general: edamame is parsing code directly into sexprs. these sexprs have metadata attached to it: line and column. then the analyzer analyzes the sexprs and also expands macros and attaches more metadata if interpretation is needed. everything that goes into the interpreter are annotated sexprs that either have an operation attached to it (interpret as a function call, interpret as interop, etc) or it's just a string, number etc that does not have metadata. if it doesn't have metadata, you also don't have to interpret it
so it's sexprs from parsing -> analyzer -> interpreter using metadata to determine what to do with it
I think there was a talk about metadata during IN/Clojure who was also going to mention sci as an example using metadata as a central tool
here's the twitter thread: https://twitter.com/amarjeet000/status/1223995397061758978
Thanks!