From f17f546fa7b34ec369f5c2f5f908d3d54b7e699a Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Tue, 28 Mar 2023 08:57:39 +0100 Subject: [PATCH] ui: add empty go.mod files to workspaces Some go tools such as go list end up traversing directories that don't have go.mod files, looking for go packages. If you happen to have built the UI recently, that means about tens of thousands of extra stat calls. On macOS, this is very expensive, even with warm caches. For example: ``` time go list -modfile=go.mod -mod=readonly -e ARGS_ELIDED -- builtin github.com/cockroachdb/cockroach/... > /dev/null 2>&1 real 0m28.309s user 0m23.541s sys 0m50.926s > for i in pkg/ui/workspaces/*/; do touch $i/go.mod; done > time go list -modfile=go.mod -mod=readonly -e ARGS_ELIDED -- builtin github.com/cockroachdb/cockroach/... > /dev/null 2>&1 real 0m13.074s user 0m18.282s sys 0m19.324s ``` The go list command I used was taken from what I observed gopls running at startup. On Linux, the impact relatively modest. I could avoid building the UI, but I like the UI. Epic: none Release note: none --- pkg/ui/workspaces/cluster-ui/go.mod | 0 pkg/ui/workspaces/db-console/go.mod | 0 pkg/ui/workspaces/e2e-tests/go.mod | 0 pkg/ui/workspaces/eslint-plugin-crdb/go.mod | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pkg/ui/workspaces/cluster-ui/go.mod create mode 100644 pkg/ui/workspaces/db-console/go.mod create mode 100644 pkg/ui/workspaces/e2e-tests/go.mod create mode 100644 pkg/ui/workspaces/eslint-plugin-crdb/go.mod diff --git a/pkg/ui/workspaces/cluster-ui/go.mod b/pkg/ui/workspaces/cluster-ui/go.mod new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/pkg/ui/workspaces/db-console/go.mod b/pkg/ui/workspaces/db-console/go.mod new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/pkg/ui/workspaces/e2e-tests/go.mod b/pkg/ui/workspaces/e2e-tests/go.mod new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/pkg/ui/workspaces/eslint-plugin-crdb/go.mod b/pkg/ui/workspaces/eslint-plugin-crdb/go.mod new file mode 100644 index 000000000000..e69de29bb2d1