So I tried adding six additional methods to Babashka that are necessary to implement auto-completion for Java methods. That increased the binary size by 29 Mb. š¬ Iām guessing thatās probably a no-goā¦
it is likely that you're hitting a dynamic require / resolve which causes this
show me the diff and I'll be able to tell you
That's it?
Yes.
Ī» du -h /usr/local/Cellar/babashka/0.9.161/bin/bb
69M /usr/local/Cellar/babashka/0.9.161/bin/bb
Ī» du -h bb # Compiled after the changes above
98M bb
have you done an experiment to see what exactly causes the difference, any one of those specifically?
I havenāt yet.
Could do.
Hold on while I sacrifice some CPU cycles at the altar of progressā¦
By the way, I ran upx on bb just for fun and it brings the binary size down to 21M. āCourse, canāt be sure it doesnāt break anything, though.
it increases startup time
Oh, I see. š
btw there was also a request recently to add clojure.reflect in bb - since we're already using it in the nrepl server it might just be a small addition
Hmm, OK. Well, that depends on a number of java.lang.reflect things, too, I think.
yes, but we're already using it and it didn't impact the image size that much
this is why it would be interesting to see which one of the above is the offender
perhaps package makes a lot of things reachable
Ah, OK, I misunderstood. Yeah, Iāll figure it out.
It doesnāt seem to be Package. Thatās the first one I tried.
well it isn't the method addition since the image even became smaller here when I added that ;)
Hmm, heh. š
Init:
-rwxr-xr-x 1 borkdude staff 71656399 Sep 9 18:01 ./bb
Added methods to reflect.Method:
-rwxr-xr-x 1 borkdude staff 71639887 Sep 9 19:58 ./bb
Added java.lang.reflect.Modifier
-rwxr-xr-x 1 borkdude staff 71639887 Sep 9 20:01 ./bbwhat did you add wrt/
java.lang.reflect.Field
it's not clear to me from the diff
Oh, hold on. I just realized Iām using an older version of GraalVM. Can that affect the size?
possibly
Just getName.
Iāll install the correct version, too.
Added java.lang.reflect.Field
-rwxr-xr-x 1 borkdude staff 71639887 Sep 9 20:06 ./bb Well. I must be doing something wrong, then.
now the only one left is package
And after adding package:
$ ls -lat ./bb
-rwxr-xr-x 1 borkdude staff 71639887 Sep 9 20:09 ./bbIt is the old GraalVM version. picard-facepalm
basically no growth
I'll make a branch and push it so it can run on CI
Yeah, I got the same result after updating GraalVM. Sorry for wasting your time.
the newest graalvm is also a lot faster. which version did you use
graalvm@21.1.0
interesting
(It is the latest available version on jabba, which is why I initially thought it is the latest available version period.)
Well, I guess itās good to know that theyāve optimized it to that extent. š
let's follow the image sizes in #babashka-circleci-builds
$ ls -lat ./bb
-rwxr-xr-x 1 borkdude staff 71639887 Sep 9 20:53 ./bb
with your PR... still nothing. Would appreciate it you could post a diff based on the previous commit, an absolute number doesn't say it all since the image size varies per environmentGotcha. š
These changesāll get us here: https://tutkain.flowthing.me/bb2.mov
Heh. š Letās see how long it takes for me to ship this. š
Anyway, thanks once again. š
No problem, thank you for moving things forward :)