Live data from Hacker News

Command-line apps with Clojure and GraalVM: 300x better startup times

astrecipes.net

61–66 of 66 posts

Re: Command-line apps with Clojure and GraalVM: 300x better startup times

#61

Earlier quoted context omitted.

With Clojure you get that feedback loop by running everything in an open repl. No startup time needed.

so you rerun tests in a REPL? what happens when something is redefined?

Typically Clojure apps are structured to be reloadable meaning that you don't have any global state, and you can easily flush the current REPL state http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-r...

There are also tools like lein-test-refresh https://github.com/jakemcc/lein-test-refresh that figure out what needs to be reloaded automatically. You start it up, it watches your namespaces for changes, and reruns tests as needed. As a bonus it can even hook into your OS notification system and let you know if any tests fail.

Re: Command-line apps with Clojure and GraalVM: 300x better startup times

#62
post #60
post #53

Earlier quoted context omitted.

Or use like lots of other languages that provide all these "wins" without having to provide justifications like "only for release build and if your tool gets used more than once".

I spend most of my time actually programming in the language, not compiling it. So, I'm going to optimize for that, but to each his own I suppose.

It's not an either-or, you can have both.

Re: Command-line apps with Clojure and GraalVM: 300x better startup times

#63

Earlier quoted context omitted.

strip it

I use upx if I don't plan on having binary patch updates. But I wanted to be fair with the article. Well, to be fair with Go, I should say 2MB for an hello world app like the one they have.

The hello world app has Clojure Schema and Orchestra validators built in, that's not very simple (though you don't see it).

Re: Command-line apps with Clojure and GraalVM: 300x better startup times

#64
post #62
post #60

Earlier quoted context omitted.

I spend most of my time actually programming in the language, not compiling it. So, I'm going to optimize for that, but to each his own I suppose.

It's not an either-or, you can have both.

I can't really think of a language that I'd rather use than Clojure right now. So, I'd have to get these "wins" I'd have to switch to working with a language I enjoy less.

Re: Command-line apps with Clojure and GraalVM: 300x better startup times

#65

Why cannot Java probuce binaries that can be mapped into memory and shared like native executable files? It could solve the startup time problem. Google even had to invent a zygote process in Android to make apps start faster.

It can and has been implemented even for OpenJDK, check out http://openjdk.java.net/jeps/295

Re: Command-line apps with Clojure and GraalVM: 300x better startup times

#66

Earlier quoted context omitted.

With Clojure you get that feedback loop by running everything in an open repl. No startup time needed.

so you rerun tests in a REPL? what happens when something is redefined?

A lot of editor integration will handle reloading and test-running for you (including VSCode's calva extension, Cursive, and Proto REPL for Atom, although it's less "automatic" than the others).
Post reply on HN