Fork me on GitHub
#shadow-cljs
<
2022-09-12
>
robert-stuttaford05:09:02

is there documentation focused on build performance, specifically, on how to maximise it? parallelism, caching setup, etc

robert-stuttaford05:09:54

one specific question i have is, can i build multiple targets in parallel, given that they all share a common base module? ideally it'd compile the base first and then compile all the targets in parallel afterwards

thheller05:09:55

@robert-stuttaford build performance is pretty much optimized by default and there are no settings to make it faster, only to disable threads etc which makes it slower

thheller05:09:13

builds are always isolated and they share nothing. each has its own cache.

thheller05:09:14

compiling multiple builds in parallel is possible but experience has shown that it is in fact pretty much identical in speed in doing them sequentially

thheller05:09:50

that is because the build already uses a maxed out threadpool, so other builds spent most times waiting

robert-stuttaford05:09:02

ok, interesting, thank you @thheller!

robert-stuttaford05:09:06

so given that, the most ideal build set up to take advantage of that is one build with several modules, as that way there'll only be a single cache?

thheller06:09:17

depends on what kind of performance you are talking about

thheller06:09:55

it makes no sense to pull stuff into a build that doesn't belong in it

thheller06:09:23

and multiple builds usually is no problem once their cache is hot

thheller06:09:47

since they'll only compile the minimal set afterwards

robert-stuttaford06:09:41

yeah caching is difficult because we use buildkite which uses multiple agents on multiple hosts, so right now we effectively run clean every time. we're going to look into ways to ensure a stable caching setup

thheller16:09:10

one thing I just assumed you are doing which you might not actually be doing is running multiple builds in one command

thheller16:09:38

shadow-cljs release build1 build2 is much faster than shadow-cljs release build1 && shadow-cljs release build2 since only one shadow-cljs instance is started

robert-stuttaford06:09:31

yes we're already doing one command!

👍 1
thheller06:09:21

yes, a proper cache is the most important thing for performance

robert-stuttaford06:09:54

o7 thank you for responding so quick, have an awesome day sir!

👍 2
Daniel Gerson12:09:40

Hello. Does shadow-cljs support subpath imports in the context of :esm target? Or am I doing something wrong? https://github.com/dmg46664/problems/tree/main/02_shadow-subpath-imports

thheller15:09:45

this is not supported but if you are building for node anyways it doesn't need to be supported

thheller15:09:16

you can set :js-options {:js-provider :import} in the build config as described here https://shadow-cljs.github.io/docs/UsersGuide.html#_third_party_tool_integration

👍 1
juhoteperi16:09:00

I'm trying to configure server addr for RN app with :local-ip option, looks like option from command shadow-cljs watch android --verbose --config-merge '{:local-ip "127.0.0.1"}' isn't picked up but adding it to ~/.shadow-cljs/config.edn does work. Docs mention that --verbose output should display the used IP(s) but I'm not seeing those messages (https://github.com/thheller/shadow-cljs/blob/846446eb49e51daf9c25b6016603afe38b6d4768/src/main/shadow/cljs/devtools/api.clj#L604 https://github.com/thheller/shadow-cljs/blob/846446eb49e51daf9c25b6016603afe38b6d4768/src/main/shadow/cljs/devtools/api.clj#L604)

juhoteperi16:09:11

This is with 2.20.1

juhoteperi16:09:28

Looks like the ::multiple-ips log call is inside comment form now.

juhoteperi16:09:47

And there isn't any ::server-addr log calls

juhoteperi16:09:02

But I don't understand why the option isn't picked up from CLI arguments etc.

thheller16:09:57

this shouldn't be necessary anymore at all? I changed it so it tries all local ips until it finds one that works

thheller16:09:41

no more reports of failed connections ever since I added that

juhoteperi16:09:44

Well, my WIFI or firewall is probably blocking all incoming connections, I could figure that out, but I've usually just used adb reverse to tunnel traffic, in that case the phone needs to access localhost which isn't included in the list.

thheller16:09:42

hmm I don't do any RN development so no clue how adb works

thheller16:09:26

I guess I could add support for :local-ip per build back in (since config-merge only applies to the build config)

thheller16:09:22

hmm ok thats outdated and doesn't work anymopre

juhoteperi16:09:24

Looks like the localhost version isn't going to work as RN/JS forbids access to localhost

juhoteperi16:09:11

Which is interesting because RN packager is connected through localhost... But I'll just figure out why the phone can't connect to Shadow-Cljs with the LAN IP

thheller19:09:13

nah, that entire function is dead and no longer used

thheller19:09:37

just leaving it in case anyone is using it

GHvW17:09:39

I'm trying to use "preact/hooks" in a cljs app, but every time I try to use one of the hooks, I get an error like this: Cannot read properties of undefined (reading '__H') it happens in the repl and when running the app. the require looks roughly like this in the app: (:require ["preact/hooks" :refer [useState]]) anyone happen to know why I might be getting that error and/or what I'm missing?

Ivan Fedorov20:09:44

Hi Thomas, thanks for all the support! Regarding externs again – they are all summed up before being fed to Closure, right? Let’s say we have: • simplified externs/app.txt • and externs/app.js They both will be fed to Closure compiler, right? Or are these mutually exclusive?

thheller20:09:37

correct, they are all added

❤️ 1