Fork me on GitHub
#graalvm
<
2020-03-06
>
lread15:03:35

Updated our clj-graal-docs to reflect momentous release of Clojure 1.10.2-alpha1 🎉 https://github.com/lread/clj-graal-docs/commit/2de39cddfa1af54868ff7297ed3c04093d734ad1

🎉 4
❤️ 4
borkdude15:03:00

Other good news: I was able to restore the startup time of babashka on version 20 from 25ms back to 13ms with a "hack" that I got from the GraalVM developers: https://github.com/oracle/graal/issues/2136#issuecomment-595814343

🎉 4
lread15:03:27

Cool! It is not Clojure specific, but maybe worth pointing to from clj-graal-docs?

lread15:03:42

I shall do

lread15:03:08

sweet! tx!

borkdude16:03:02

Cool! Small annotional note: the issue only happens with specific usages of certain classes that are somehow related to security, urls and whatnot. So not all projects will hit this issue.

borkdude16:03:43

Maybe it's also related to enabling the SSL stuff. Likely, but I haven't tested that hypothesis.

lread17:03:34

tx, added the above notes to clj-graal-docs

👍 4
borkdude16:03:04

Here is a binary compiled with a 20 dev version with the patch of conditional loading the macOS library (this is what they did fix). And the additional tweak. https://4891-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.75-SNAPSHOT-macos-amd64.zip

borkdude16:03:44

$ multitime -s0 -n100 ~/Downloads/bb-20dev -e 'nil'
===> multitime results
1: /Users/borkdude/Downloads/bb-20dev -e nil
            Mean        Std.Dev.    Min         Median      Max
real        0.015       0.002       0.013       0.015       0.022
user        0.005       0.000       0.005       0.006       0.006
sys         0.005       0.001       0.004       0.005       0.011

borkdude16:03:16

Hmm, maybe mentioning the multitime util to measure startup time is also a nice addition. sogaiu brought it to my attention

borkdude16:03:24

Maybe we should also have build instructions in the repo for GraalVM itself. E.g. here they are welcoming a contribution: https://github.com/oracle/graal/issues/2136#issuecomment-595847888 But I would first have to figure out how to set up all this stuff if I were to contribute.

borkdude16:03:45

Again, sogaiu has figured this out once I think.

lread17:03:41

yeah multitime is new to me as well, (thanks @sogaiu!)

👍 4
wcohen18:03:08

@borkdude did you ever get sqlite working with native-image?

mkvlr20:03:26

what’s the biggest apps that people have used native image for successfully?

mkvlr20:03:31

I probably should not expect this to ever finish, and successfully less so :thinking_face:

wcohen20:03:19

Additionally, I'm trying to get geo to work on graal but struggling with this JNI: https://github.com/Factual/geo/blob/master/src/geo/h3.clj#L16 It loads a native library from a resource after copying it to a temp file, so System/loadLibrary can't just be called in main to give it to graal: https://github.com/uber/h3-java/blob/master/src/main/java/com/uber/h3core/H3CoreLoader.java#L122 Using something like {"pattern":".*libh3.*"} in resource-config.json seems to embed the resources in the binary, but I can't get graal to get past the UnsatisfiedLinkError, even if I manually add in the native methods into jni-config.json. This (https://github.com/oracle/graal/issues/1828) suggests turning off --initialize-at-build-time in situations like these, but that option seems necessary to get native-image to work with clojure in general. Any ideas?

borkdude20:03:08

@wcohen For JNI examples, see clj-graal-docs

borkdude20:03:35

@wcohen Here is an example that talks to a Postgres DB: https://github.com/leafclick/pgmig

borkdude20:03:12

I haven't tried sqlite in a while, it's not trivial but since the postgres example works, I expect it to be possible

wcohen20:03:56

Yes -- that example and clj-graal-docs have been quite helpful. The question around sqlite is the same as this one, since sqlite embeds a range of platform-dependent binaries that get copied to a temp file and loaded on startup

borkdude20:03:39

@mkvlr > what’s the biggest apps that people have used native image for successfully? In general I think it's best to start small, there are a lot of things that can make native-image go 📈 and you want to have an idea what's causing it.

mkvlr20:03:21

right, compiling our whole thing to native image also doesn’t make any sense

mkvlr20:03:54

but I’ll keep trying every now and then… 😼

borkdude20:03:52

if it works the first time, there's probably something wrong.