joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
jcburley 2020-02-19T02:04:09.018700Z

I've created a "proper" PR for my startup-time-optimization work -- please try it out and let me know how it compares, performance-wise (and of course whether it works!), to "official" Joker: https://github.com/candid82/joker/pull/358

borkdude 2020-02-21T18:43:13.030400Z

Can you give an indication of what it was before and what it is right now on master?

❓ 1
borkdude 2020-02-21T18:44:13.030700Z

the startup time

borkdude 2020-02-21T18:45:38.031200Z

and in ms?

jcburley 2020-02-21T18:46:21.031400Z

32ms on my Ryzen 3 down to 5ms. All approximations, of course.

borkdude 2020-02-21T18:46:32.031600Z

impressive!

borkdude 2020-02-21T18:48:45.032200Z

when this lands in a release, I'll try it out on my own machine and reflect this in a slide deck where I compare various Clojure scripting options

borkdude 2020-02-21T18:49:02.032400Z

right now I've taken timings from a blog post by Stuart Sierra

borkdude 2020-02-21T18:51:12.032900Z

if you have a macOS binary around with these speedups, I'd be happy to give it a spin

jcburley 2020-02-21T18:52:13.033100Z

Not handy right now, but could get one to you in the next hour or so...but how?

borkdude 2020-02-21T18:52:36.033300Z

as a zip file here on Slack maybe?

borkdude 2020-02-21T18:52:58.033500Z

other way: my e-mail is <mailto:michielborkent@gmail.com|michielborkent@gmail.com>

borkdude 2020-02-21T18:53:59.033700Z

I build binaries on CircleCI where I can get download links to the artifacts. I also sometimes just pass those links to people

jcburley 2020-02-21T18:54:21.033900Z

Gmail has strict attachment size limits. Will try here.

jcburley 2020-02-21T18:55:20.034100Z

Or, hey, could just post to my own web server and send you a link! 😀

borkdude 2020-02-21T18:55:35.034300Z

sure! 🙂

jcburley 2020-02-21T18:56:33.034500Z

Gimme an hour or less.

borkdude 2020-02-21T18:58:06.034700Z

no hurry, the presentation is next week

jcburley 2020-02-21T19:18:46.034900Z

Ooh, what presentation??

borkdude 2020-02-21T19:28:45.035100Z

about babashka

jcburley 2020-02-21T19:35:12.035300Z

Cool! Please share a link or something here. Is it a public event or similar?

borkdude 2020-02-21T19:35:45.035500Z

it is the ClojureD conference

borkdude 2020-02-21T19:36:20.036Z

https://clojured.de/schedule/#michielborkent

borkdude 2020-02-21T19:36:52.036200Z

it seems that the fast one is 5 MB bigger, is that because of more pre-compiled code?

jcburley 2020-02-21T19:37:48.036400Z

Yes, that’s a 25-33% increase in size or so, pretty consistent across my 3 architectures IIRC.

borkdude 2020-02-21T19:37:58.036600Z

===&gt; multitime results
1: ./joker.fast -e "(+ 1 2 3)"
            Mean        Std.Dev.    Min         Median      Max
real        0.017       0.002       0.015       0.016       0.039

borkdude 2020-02-21T19:38:04.036800Z

that's about what I get with bb too

borkdude 2020-02-21T19:38:21.037Z

for reference, I ran:

$ multitime -n100 -s0 ./joker.fast -e '(+ 1 2 3)'

borkdude 2020-02-21T19:39:03.037200Z

so I guess I can just say: bb and joker have comparable startup time 🙂

👍 1
jcburley 2020-02-21T19:39:52.037400Z

Well that’s pretty good (for Joker) I guess! But bb has all the JVM libs available to it? Is there a list of “big” stuff missing in bb versus Joker, that we can compare to a similar list for Joker?

borkdude 2020-02-21T19:40:50.037700Z

it doesn't have all classes, only those that we selected: https://github.com/borkdude/babashka/blob/7b30927a12608df6fe02fdd522c077fd9fe3eadd/src/babashka/impl/classes.clj#L15

jcburley 2020-02-21T19:41:56.038200Z

At quick glance that seems more comprehensive than Joker…is there anything Joker has that bb doesn’t offer?

jcburley 2020-02-21T19:42:19.038400Z

Also I would appreciate your input on this thread, starting with my comment the other night:

borkdude 2020-02-21T19:43:05.038900Z

I think joker has a few things that bb has not, like a built-in http client, xml and yaml, which are on the list for bb.

borkdude 2020-02-21T19:43:24.039100Z

we do have support for a user-land clj-http library

jcburley 2020-02-21T19:43:25.039300Z

tl;dr: We can improve joker, we can improve bb, etc., but what is the 30K-foot overview of what the most promising combination of implementation language likely to be?

jcburley 2020-02-21T19:43:39.039500Z

Does bb do multithreading better than Joker?

borkdude 2020-02-21T19:43:57.039700Z

bb offers real threads like you're used to from clojure, it has pmap, future, agents, promises, etc

jcburley 2020-02-21T19:44:52.039900Z

For classic scripting, that’s probably fine; but there are various use cases I could imagine for Joker, even as a scripting language, that bb would be better suited for simply because it has the real Clojure-style MT.

borkdude 2020-02-21T19:44:57.040100Z

I think my life of adding stuff from the clojure eco-system inside bb is much easier: if I'm lucky, I can just stick a function inside a map and I'm done

borkdude 2020-02-21T19:45:36.040300Z

this is basically the entire clojure.core namespace: https://github.com/borkdude/sci/blob/master/src/sci/impl/namespaces.cljc

jcburley 2020-02-21T19:45:39.040600Z

That’s great! Offhand, do you have a sense of how GraalVM is doing in terms of stability, performance improvements, roadmap going forward, etc.? I was following the mailing list for it for awhile until early last year when things got real busy.

borkdude 2020-02-21T19:46:38.040900Z

GraalVM has LTS releases and non-LTS releases, so in that regard they try to offer more stability I guess

borkdude 2020-02-21T19:47:03.041100Z

they also have a Slack where you can ask questions to users and developers. they are quite responsive to issues on Github as well

jcburley 2020-02-21T19:48:57.041300Z

As you’ll see from that discussion in the Issue on main programs in Joker, I’m very interested in whether Go, or GraalVM, or Rust, or whatever, would be enough-better, in terms of improvement over where we are right now, to justify a) continued work on Joker (in particular I have my gostd branch to auto-support the Go std libraries plus arbitrary 3p ones, but much more work is needed there), b) rewriting/rehosting Joker to another language, c) leaving Joker as a quick linter and moving to something like bb, or d) some other possibility I haven’t considered.

borkdude 2020-02-21T19:49:04.041500Z

babashka is basically split up into two libraries: sci (the interpreter) and edamame (the code parser). other users can make something like bb but geared towards more specialized goals, like generating static websites. one such tool is called bootleg: https://github.com/retrogradeorbit/bootleg, it has hiccup, templating, etc.

jcburley 2020-02-21T19:49:22.041900Z

(Right now, even without MT, Joker plus gostd would meet most of my needs beautifully.)

borkdude 2020-02-21T19:49:52.042100Z

I didn't quite understand the thread about -main. I do support -main functions in bb just like the clojure cli does

borkdude 2020-02-21T19:50:39.042300Z

bb also understands classpaths as produced by clojure so you can use some normal JVM libs without any change: https://github.com/weavejester/medley is an example of this

👍 1
jcburley 2020-02-21T19:50:40.042600Z

I’ll make some time to look over the bb ecosystem soon then, as it came to my notice many months ago (probably due to one of your tweets) and I’m intrigued by the idea of a “more-Clojure-like-Clojure” that starts up very quickly and doesn’t have GB of VM overhead like Clojure does for even a simple service.

jcburley 2020-02-21T19:50:49.042900Z

That sounds great!

borkdude 2020-02-21T19:51:46.043100Z

joker is an enormous inspiration for both clj-kondo and babashka so I do follow what happens in this ecosystem too. I hope we can benefit from each others work.

🙂 1
jcburley 2020-02-21T19:51:59.043300Z

If Joker had gostd (i.e. ready access to the Go std libs), drop-in core libraries (which I think we can support without too much work), and maybe “true” MT, would you see it as being worth using versus where you see bb headed?

borkdude 2020-02-21T19:52:55.043700Z

I'm not familiar with the Go ecosystem at all. I see it as a plus that I get to write Clojure while writing bb and also while using it 🙂

👍 1
jcburley 2020-02-21T19:53:51.043900Z

Oh, just saw your response about -main — I pointed to the part in that thread where I respond to @roman.bataev’s query about a potential Joker compiler and explain why I’m not sure that’s worth doing, even though I think about it a lot and would surely enjoy working on one. Could be in that “we can do it, but should we?” category.

borkdude 2020-02-21T19:54:58.044200Z

the sci interpreter (which bb is based on) also runs on JS btw, there are already some projects leveraging this for e.g. Slack bots in a Google cloud function

👍 1
borkdude 2020-02-21T19:55:28.044400Z

ah, about compiling: I think it's nice to not have to compile, for scripting, like you do with bash. Just text, no steps in between

👍 1
jcburley 2020-02-21T19:55:37.044600Z

It’s funny, now that I’ve worked on Joker pretty much exclusively (during my free time) the past 18 months or so, my Clojure knowledge has probably declined somewhat since I’m not actually doing that much programming in it. I.e. most of my Clojure programming is Joker code in support of building and testing Joker, not real-world stuff. Haven’t reviewed my Clojure flashcards in over a year….

borkdude 2020-02-21T19:56:19.045Z

there is a place for everything I guess. CLJS does compilation to JavaScript which then can be quite fast on Node regarding startup, but the step in between is what it makes less attractive for scripts imo

👍 1
jcburley 2020-02-21T19:57:07.045200Z

Yeah, I think @roman.bataev is most interested in behind-the-scenes, versus “overt”, compiling. I.e. not compiling a script or lib/namespace down to an artifact, but JIT’ing interpreted code in the background. Whereas I’d like to have the static-compile-to-an-artifact feature more, I think!

borkdude 2020-02-21T19:57:34.045500Z

for the latter I think GraalVM is very well suited

jcburley 2020-02-21T19:57:57.045700Z

Oh, interesting! Somehow I thought GraalVM was primarily a JIT.

borkdude 2020-02-21T19:58:42.045900Z

GraalVM comprises several parts: Truffle/Polyglot and native-image. I've only used native-image. What it does: translate .class files to native binary. Once it's compiled there is no JIT anymore.

👍 1
jcburley 2020-02-21T19:59:04.046100Z

Really gotta climb up the stack, now that the fast-init stuff is done (and after I get my taxes done 😉 ), and learn more about all these technologies at an architectural level soon.

borkdude 2020-02-21T19:59:25.046400Z

if you have any questions, feel free to reach out. congrats on the startup!

👍 1
jcburley 2020-02-21T19:59:50.046600Z

Thanks, will do! And have a great presentation next week!

borkdude 2020-02-21T19:59:59.046800Z

there's also a #graalvm channel and some docs on graalvm here: https://github.com/lread/clj-graal-docs

👍 1
borkdude 2020-02-21T20:00:03.047100Z

thanks!

👍 1
Candid 2020-02-19T05:48:17.018900Z

xml-seq doesn't actually parse XML. Joker currently doesn't have XML parsing functionality.

borkdude 2020-02-19T15:26:08.019800Z

I'm discussing something regarding reader conditionals in the #clojure channel which may also be of interest to joker. Notably, this just got added to https://clojure.org/reference/reader#_reader_conditionals: > Implementors of non-official Clojure platforms should use a qualified keyword for their platform feature.

👍 3
borkdude 2020-02-20T13:15:28.024600Z

We can probably take this to the International Unofficial Clojure Implementation Summit, together with Clojerl 😉

🙂 1
borkdude 2020-02-19T15:47:30.020500Z

To be honest, I have no clear idea on what to name the feature. See #clojure .

👍 1