Fork me on GitHub
#shadow-cljs
<
2023-09-14
>
steveb8n00:09:42

Curious: has anyone tried running shadow code in Bun yet? 4 x perf over node is alluring

steveb8n00:09:50

oh, just saw the question above 🙂

thheller09:09:19

shadow-cljs is implemented in clojure and runs on the JVM. there is a tiny amount of JS code that is running when you run the shadow-cljs command. everything else is not JS, so making something that already takes less then 50ms faster is quite pointless

thheller09:09:29

so, effectively you will gain absolutely no benefit by using bun over node

thheller09:09:53

it might just work, but I haven't tried it

steveb8n09:09:17

I'm thinking about the runtime perf, not compile or dev performance. That could be improved if the runtime is faster right?

thheller09:09:45

as I said ... shadow-cljs is 99% clojure and runs in the JVM. it barely executes any JS

thheller09:09:53

so no, it will have absolutely no effect whatsoever

thheller09:09:19

ah sorry ...

thheller09:09:29

runtime perf of your app, not shadow-cljs 😛

thheller09:09:39

yes that might benefit. but shadow-cljs doesn't care where you run something

thheller09:09:51

just run the output in bun, I assume it'll just work

thheller09:09:13

but again .. I haven't looked at bun at all or used it

thheller09:09:24

I don't use JS server side and bun is not going to change that

steveb8n09:09:37

It doesn't yet fully replicate all node APIs so it'll depend on the app. I plan to try it and will report back here if nobody beats me to it

thheller10:09:23

hot-reload is dependent on the npm ws module, so that might not work

thheller10:09:40

but a release :node-script or :esm build I expect to work without any issues

steveb8n10:09:09

I'd be happy to keep node for dev

steveb8n10:09:37

Tests could ensure compatibility

thheller10:09:53

:esm is a standard after all, so it should just work. maybe it won't like the dev hacks shadow-cljs does, but release most definitely will just work

steveb8n10:09:08

Crazy ideas but interesting to try

steveb8n10:09:20

Thanks for responding

dehli14:09:09

👋 Hey, i've got a quick question about the :esm target. Is it possible to reference import from shadow-cljs? I've tried js/import but that ends up becoming import$ and is undefined. I specifically want import.meta.url (as shown here https://webpack.js.org/guides/web-workers/) Edit: It looks like their special syntax is for auto generating bundles (I've already got the bundles generating via shadow) so it's not going to work for me. Went with a different approach so don't need ^ anymore.

thheller16:09:06

FWIW import.meta.url is not currently supported as the closure compiler does not support it.

dehli16:09:12

Gotcha. Thanks for following up!