graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
ghadi 2021-02-13T00:02:18.183700Z

thanks y'all

ericdallo 2021-02-13T00:23:45.183900Z

So, after a lot of debugging I started to wonder if babashka is really being compiled with those flags, I added this to babashka main first line:

(println (System/getProperty "borkdude.dynaload.aot"))
  (println (System/getProperty "clojure.compiler.direct-linking"))
  (println (System/getProperty "clojure.spec.skip-macros"))
Then I run:
script/uberjar
script/compile
and when running ./bb I get:

ericdallo 2021-02-13T00:24:12.184300Z

I'm probably missing something during the build, but could not figure it out 😔

borkdude 2021-02-13T08:07:44.185400Z

These properties are not part of the runtime, only during build

borkdude 2021-02-13T08:08:18.186400Z

So you should put them on the top level and watch if they are printed during compilation

borkdude 2021-02-13T08:08:36.187Z

Of both Clojure and GraalVM

ericdallo 2021-02-13T14:12:02.187200Z

Oh, now it makes sense!

ericdallo 2021-02-13T15:47:32.188200Z

About the UPX, the size of clojure-lsp was reduced from 107MB -> 29MB with a drawback of 300ms on the startup

1👍
ericdallo 2021-02-13T15:47:55.188700Z

I'll do some tests but the trade-off for clojure-lsp looks good

1🎉
ericdallo 2021-02-13T15:48:39.189100Z

Probably will use this action on the CI: https://github.com/svenstaro/upx-action

borkdude 2021-02-13T16:00:10.189500Z

Does it work on all platforms?

ericdallo 2021-02-13T16:00:35.190Z

the action say it does, I'll test if it works nice with graalvm compiled binaries yet

ericdallo 2021-02-13T16:01:31.190200Z

So, the clojure.compiler.direct-linking was correctly configured, it was just missing the dynaload config that i"ll add now 🙂

borkdude 2021-02-13T16:02:02.190400Z

🎉

ericdallo 2021-02-13T16:12:39.190600Z

It indeed reduced from 117MB -> 109MB 🙂

ericdallo 2021-02-13T16:12:55.190800Z

it's something indeed, with UPX this should be < 29MB

ericdallo 2021-02-13T16:13:05.191Z

thanks for the help @borkdude

borkdude 2021-02-13T16:13:13.191200Z

:)