Fork me on GitHub
#babashka
<
2020-05-28
>
littleli06:05:36

@borkdude if there is a concern regarding binary size, I just run upx on the bb binary (on Mac) and it's quite successful:

File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
  61167248 ->  19255312   31.48%   macho/amd64   bb                            

borkdude06:05:44

Nice! How does this affect the startup time?

littleli06:05:40

what can I do to test this?

littleli06:05:40

oh, yeah, it takes quite some time 😄

littleli06:05:52

ᐅ time ./bb --version
babashka v0.0.99
./bb --version  0.24s user 0.03s system 97% cpu 0.282 total

littleli06:05:46

I believe it approximately doubles the time required to launch the binary.

littleli06:05:21

it's probably even worse

borkdude06:05:22

Try installing a tool called multitime, then you can run it multiple times and it will report the average. What is the original startup time though?

borkdude06:05:51

Oh 240ms yeah

borkdude06:05:54

Can upx bundle scripts with bb?

littleli06:05:43

I think it only focuses on binary compression

littleli07:05:40

it would only work, if scripts were attached to the binary in form of overlay (append-at-the-end)

littleli07:05:02

but I don't know how to even produce such a binary from this point... no idea

littleli07:05:33

but one day this thing can be interesting hacking session

littleli07:05:20

multitime output, 30 runs:

===> multitime results
1: ./bb --version
            Mean        Std.Dev.    Min         Median      Max
real        0.272       0.008       0.258       0.275       0.282       
user        0.234       0.007       0.222       0.237       0.243       
sys         0.032       0.002       0.028       0.032       0.036 

littleli07:05:39

TIL (multitime)

🙂 1
borkdude07:05:44

Pretty bad :-)

littleli07:05:00

yeah, and I believe Catalina and sip and linking don't help much. Usually UPX is pretty fast.

littleli07:05:51

I'm quite disappointed recently with anything Apple releated.

littleli07:05:59

but that's a little different story

littleli07:05:52

it would be nice to try on statically linked binary on linux for example

borkdude08:05:22

feel free to try it. which macOS are you running? I'm still on mojave

littleli10:05:28

I'm on Catalina

borkdude10:05:24

let me try it on my machine then. you might be a "victim" of notarization checks. do you have LittleSnitch?

borkdude10:05:14

About the same on mojave:

$ time bb-upx -e 'nil'
bb-upx -e 'nil'   0.21s  user 0.03s system 97% cpu 0.240 total

borkdude10:05:42

It's a nifty tool, but binary size so far has not been a concern for anyone

borkdude10:05:09

Although I'd like to keep it as small as possible while also preversing startup time

littleli11:05:29

yeah, I agree.

borkdude11:05:02

btw, decided to use babashka to generate a .circleci/config.yml instead of manually writing it, since I needed to repeat the same jobs with just one environment variable difference: https://github.com/babashka/babashka-sql-pods/blob/36b890fee3628d77ea1b16e15142112c2dfdd1c0/script/generate_circleci.clj

babashka 8