Repository navigation
Conversation
LoadFromFS copies the whole CUE tree to a temporary directory for every service (thousands of file writes on a large app). Split it into WriteToDisk and LoadFromDir, and write the tree once per service-config pass. A service's config is evaluated with the generated encore.gen.cue of every service present in the tree, not only those added before it. Each service still loads only the files under its own path, and the resulting configs are unchanged on a large app. Computing service configs is several times faster.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cueutil.LoadFromFScopies the whole CUE tree to a temporary directory for every service: thousands of file writes on a large app.WriteToDisk, which writes the tree once and returns a cleanup function, andLoadFromDir, which loads one service from it.computeConfigsfirst generates every service's CUE, then writes the tree once and loads each service from it.Why this should not change existing behaviour
LoadFromDircontains the same CUE loading, orphaned-file handling and validation as the old function, with the temporary directory passed in.encore.gen.cueof every service in the tree, where before it saw those of the services generated before it. A config that imported another service's generated package would therefore have depended on service order, so none that works today can rely on that.LoadFromFSis internal to theencr.devmodule and had no other callers.Testing
go test -race ./pkg/cueutil/... ./v2/v2builder/...go vet,golangci-lint --new-from-rev=origin/main(0 issues) and a Windows build.Need help on this PR? Tag
@codesmith-botwith what you need.