babashka-sci-dev 2021-12-15

@borkdude what is https://github.com/babashka/babashka/pull/1099/files#r769331216 used for? should i comment it back again? apart from this the PR looks quite ready for action 😄

yeah we can probably leave that out. it's a test that you can run bb with deps.edn

finally! thanks a lot @cap10morgan 🎉

👍 2

nice! so now you can run these images on arm cloud things - is that the main benefit?

Please also update the CHANGELOG.md (with a [skip-ci] in the message)

and also on Mac M1 + Docker I guess

yep, both of those are my use cases :)

➕ 1

I wonder if the docker arm images are way faster on M1

they should be. the amd64 ones were run on qemu

ooh ouch, that's slow right? can't you "just" run docker via rosetta2 and then run amd64?

I don't have an M1 yet

Just had my i9 macbook pro repaired ;)

no, rosetta2 can't run x86_64 virtual machines

so docker's embedded linux VM has to be arm64

oh, that's really limiting I guess

at least for early adopters of M1

it's been surprisingly not so far. I thought the same thing going in, but then all of the earlier-than-me adopters were still just getting work done so I took the plunge. been great so far!

but yeah, there was likely more pain earlier than I jumped on board

I might buy myself a Macbook Air M1 so I can just have the M1 within my reach for testing

and I can hook it up with a self-hosted circleci / github action runner when releasing 😂

if you want I can show you a nifty thing I recently figured out where you can tell your local docker "always send builds / containers of this arch over to this other host" which you could probably get pretty far w/ a raspberry pi 4 w/ 8GB of RAM. maybe not for graalvm builds, but maybe... 😉

we already have arm64 for linux, it's only mac which is missing

I'll get back on your offer when I need it

yeah, it's just nice that the builds and containers are much faster when they don't have to run under qemu

@cap10morgan curious, can you test how fast this is in m1 arm64 docker?

$ bb -e "(time (loop [val 0 cnt 10000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val)))"
"Elapsed time: 2496.274002 msecs"
10000000

compared to your rosetta2 usage on the same computer

arm64: "Elapsed time: 1421.087168 msecs" emulated amd64: "Elapsed time: 20665.796677 msecs"

always good to get an order of magnitude speed up 🙂

the emulated is pretty slow it seems

graalvm native-image builds just grind to a halt

and some things just crash

wow I feel lucky I haven't made the leap that fast then yet

but it's nice to have b/c it usually works, eventually haha

oh man, it's a tradeoff I'd make again in a heartbeat

everything else is insanely good & fast

yes, but building native images locally is a thing I do a lot

and since I learned how to farm out docker builds and runs to amd64 hosts, this isn't even much of an issue anymore either

yeah; the graalvm folks are saying early 2022 for darwin/arm64 support

I'm subscribed to the issue yeah. By that time, spring, I'll have another look.

👍 1

Perhaps some generous sponsor wants M1 support so bad they'll give me one... 🤞

that would be awesome!

but by that time CircleCI may also have support for it

or Github Actions

whatever comes first

yeah, I think once apple releases a more "pro" arm mac mini a lot of those dominoes will fall

AWS already has support for it right?

they just have a giant stack of those mac minis somewhere?

that's almost 10x slower than my i9 mac

sorry, meant to paste the link not the time again haha

yeah it's not a speed demon

I guess it's running qemu under an arm linux VM 😬

I noticed that most bb scripts don't need a lot of performance, luckily

wait, you didn't test test with rosetta2 directly - I meant, no docker

just straight from your shell

that shouldn't involve qemu right

you said, "curious, can you test how fast this is in m1 arm64 docker?" 🙂

docker-free test coming right up!

I said compared to your rosetta2 usage on the same computer but apparently this can be interpreted in multiple ways :)

ah, yeah. no rosetta2 in docker. 🙂

yeah, I meant: run it in your shell, as you would normally do as a mac user who downloads bb

yep. interestingly 0.7.1-SNAPSHOT in docker appears to be much faster than 0.7.0 outside it. did some perf improvements land?

no, but I expect that arm has some perf benefits over intel with respect to these kinds of loops

this is all arm64

sure, but rosetta2 is in between

linux/arm64 inside docker vs. darwin/arm64 outside it (maybe that's the difference)

no, no rosetta2 here

I haven't run the intel one yet

let me start over, forget everything before

as a user who installs babashka via brew on m1

and runs it in your shell, no docker

how fast is the loop

yes, I understand what you want me to do

I'm pointing out an interesting aside

bb 0.7.1-SNAPSHOT linux/arm64 in docker runs that loop much faster than bb 0.7.0 darwin/arm64 does

just thought that was interesting

I would be disappointed if that wasn't the case :)

all arm64 above, not amd64 as I unfortunately first typed

so that's what is interesting

no rosetta2 nor emulation at work here

but how fast is it then, don't keep me in suspense :)

bb 0.7.0 darwin/arm64: "Elapsed time: 2273.238791 msecs"

ok, I expected this

and then I'll need to download some things to try out intel on rosetta2

there must be rosetta2 here right, since native graalvm on arm64 isn't a thing yet for mac

ohhhhhhh yes. you're right. I keep forgetting that even though we just talked about it. facepalm

the linux vs. darwin / amd64 vs. arm64 quadrant keeps tripping me up hahaha

ok, so rosetta2: 2274, docker linux/arm64: 1500, yeah, no surprise there

that makes a ton more sense 🙂

and then rosetta2 suddenly look that bad anymore

instead of the ridiculous 20000 number I saw first

which was apparently qemu

but then graalvm should also be reasonable under rosetta2 I suspect

yes, it works decently well there

thanks!

👍 1

also docker is working on direct darwin platform support too: https://github.com/containerd/containerd/pull/4526

that will be nice someday

so, images that run darwin?

is that was allows this?

yeah, VM-less Docker on Mac

similar to the windows/amd64 images I guess

could be a pragmatic alternative to nix perhaps ;)

or at least a more performant alternative to linux image on mac