#nvm.. fake news.. seems to be uploading
1 messages ยท Page 1 of 1 (latest)
https://github.com/sipsma/dagger/blob/55a8e049ca22e7b8d76e86079e9b9e152d8b4465/core/schema/modulesource.go#L678-L680 This line is where this gets set, and yeah it does specifically happen for init actually and ends up including the "source root" which is the dir containing dagger.json.
I think it should be changed to something like:
includeSet[src.SourceSubpathWithDefault(ctx)] = struct{}{}
yep, that's what I was thinking about
I can actually confirm that dagger functions does not include it
The problem is the dagger.json doesn't exist yet, which all the logic was parsing settings from, but for the case of dagger init we do have knowledge of the source subpath (via this line from the CLI: https://github.com/sipsma/dagger/blob/55a8e049ca22e7b8d76e86079e9b9e152d8b4465/cmd/dagger/module.go#L156-L156), it's just only been set in the API rather than dagger.json at this point
idk if you have time to try that quickly, but otherwise just an issue works and we can get to it before the next release
yep, I'll try that quickly and add the proper tests tomorrow and send a PR if that works
Thank you! The integ tests for dagger init are here: https://github.com/sipsma/dagger/blob/55a8e049ca22e7b8d76e86079e9b9e152d8b4465/core/integration/module_config_test.go#L371-L371
thx ๐
defintely way faster Erik! the repo I was initializing on has a 300mb docs directory with a bunch of files. That was penalizing the init time a few tens of seconds to upload the whole thing ๐
I'll add a test and send a PR tomorrow ๐
I also have another theory about the codegen penalizing the init time quite drastically since I'd assume it goes through all existing *.go files (in a go SDK project) to scan for candidate functions to be generated?
silently pinging @silent jay
in my example, in a repo with ~900 go files, a cold codegen takes ~ 50s
โ exec /usr/local/bin/codegen --output /src --module-context-path /src/dagger --module-name tracetest
--introspection-json-path /schema.json 43.8s
with or without a fix for the above bug?
with the above **/* fix
hm, yeah, it's at least faster on subsequent runs once the local dir was loaded right?
yes. also codegen is way faster on subsequent runs
I think we need to do more general performance investigation into the filesync, it feels like something weird is happening if it takes 43s
like it's actually doing way more work than it should be
Not sure if it's the filesync or the codegen in this case
is there a way to know that? the engine debug logs don't discriminate that
the upload here seems fast https://dagger.cloud/marcos-test/traces/a996535073617e245051590c94cbb6e8#81713cad3f32e754 but not sure if this is lazily evaluated or not at this stage
oh I see, yeah .resolveFromCalleris the part where filesync happens
And it was fast because it was entirely cached
so it was just codegen that took forever
if you change a single file in the repo does codegen take 50s again?
wait.. I'm starting from a cold engine ๐ค
it shouldn't have been cached
oh, maybe I'm misreading the output, yeah actually "cache request" is saying "request to the cache" I think. So I guess the filesync actually was just only 300ish ms, which is good
yep.. that makes sense
checking now
One expensive thing codegen needs to do is download all the go mod deps
So wondering if that could plausibly explain it. But really the only way to do this correctly would be to put a bunch of a spans in the codegen code so we can drill down to what is taking so long
yes, but that seems to happen a bit later in the codegen process
the dep download starts after a few tens of seconds
Ah I see that now, cool
hm
Yeah just looking around nothing sticks out as obvious, so I think the best approach would be to put spans all over that codebase
That'll make it obvious what's taking time
๐ np, I can follow-upt with an issue
could it be that the codegen process is actually scanning through all the *.go files uploaded in the context?
instead of only looking into the module source files only?
well.. the codegen is part has a bunch of pieces.. I guess the best thing to do is to add some spans there to instrument what its' doing ๐ค
Yeah definitely possible, we don't specify NeedDeps here: https://github.com/sipsma/dagger/blob/a978b5eeb00208551c270e1245cab97ac8afb283/cmd/codegen/generator/go/generator.go#L336-L336
which in theory should avoid that sort of problem, but that packages.Load call is definitely something to look out for in terms of possible slowness culprits. Among many others
makes sense, thx! Will open an issue and get Justin's input tomorrow
definitely doesn't happen when initializing dagger in an empty folder
it only takes a few secs
FWIW doesn't happen with the python sdk in a go project. So seems related to the go SDK in a go project. Will add this info to the issue