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/.
borkdude 2020-09-30T14:09:40.025Z

Anyone got postal working with graalvm?

borkdude 2020-09-30T14:11:07.025400Z

$ rlwrap ./bb
Babashka v0.2.2-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (require '[postal.core :as p])
nil
user=&gt; (p/send-message {} {:from "<mailto:michielborkent@gmail.com|michielborkent@gmail.com>" :to "<mailto:michielborkent@gmail.com|michielborkent@gmail.com>" :body "hello"})
java.lang.NoClassDefFoundError [at &lt;repl&gt;:2:1]
I've already added [javax.activation/javax.activation-api "1.2.0"] but maybe I need some reflection config

2020-09-30T14:12:47.025500Z

maybe @alekcz360 with https://github.com/alekcz/pcp/blob/master/src/pcp/includes.clj#L13 I see it’s there, didn’t test it

alekcz 2020-09-30T14:14:06.025900Z

@borkdude @jeroenvandijk it's not working. I ended up have the core engine on JVM and the developer tool with Graalvm

alekcz 2020-09-30T14:14:32.026100Z

I did try. But ended in java mail and that was a nope.

👍 1
alekcz 2020-09-30T14:15:14.026400Z

But that was shared ago. I knew next to nothing about Graalvm then

borkdude 2020-09-30T14:30:14.026700Z

I'm getting:

javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=utf-8 [at &lt;repl&gt;:2:1]

borkdude 2020-09-30T14:31:22.027200Z

I have added:

'-H:IncludeResources=.*mailcap\.default*'
 '-H:IncludeResources=.*mimetypes\.default.*'
 
but it doesn't seem to help

borkdude 2020-09-30T14:32:15.027400Z

oh a typo maybe

borkdude 2020-09-30T14:33:06.027600Z

btw I haven't seen these resources been logged for a while with

"-H:Log=registerResource:"

borkdude 2020-09-30T15:01:00.027900Z

Maybe this Quarkus extension could be wrapped in some Clojure code: https://github.com/quarkusio/quarkus/tree/master/extensions/mailer But that wouldn't be the same as postal

borkdude 2020-09-30T15:04:30.028100Z

ok, I'll leave it at this for now, summary in https://github.com/borkdude/babashka/issues/599

sergey 2020-09-30T22:49:08.029700Z

does the -Dclojure.compiler.direct-linking=true actually do anything with GraalVM 20.2.0? I've not noticed any difference in my own projects

borkdude 2020-10-01T07:38:45.031500Z

It should have benefit on binary size and runtime speed at least, but in some cases also memory consumption during compilation

sergey 2020-10-01T17:33:54.031700Z

Gotcha. I double checked with a (medium-sized) cli app at my company and didn't notice a significant difference except for maybe a 1-2% runtime speed improvement. I also tried recompiling babashka: the compilation w/out flags used a bit less RAM, and the non-flag binary was 1.5MB smaller (69.MB vs 70.8MB). Not sure if there's a performance difference between the two babashka builds

sergey 2020-10-01T17:35:57.031900Z

Maybe there's a difference in very high-performance scenarios?

sergey 2020-10-01T18:55:13.042400Z

I've seen the epiccastle post, but wasn't aware of that issue

borkdude 2020-10-01T18:57:06.042600Z

it's not graalvm related per se, just performance related in general

borkdude 2020-10-01T18:57:11.042800Z

the sci issue

sergey 2020-09-30T22:49:44.029800Z

Also tried compiling babashka with & without it and the compilation time was faster when I removed it

sergey 2020-09-30T23:17:05.030Z

When I say "removed it" I mean I removed it in both project.clj and the -J-D flag in the call to native-image that compiles the binary