Skip to content

[v13] Makefile: cache go env values#25894

Merged
marcoandredinis merged 1 commit intobranch/v13from
auto-backport/25870-to-branch/v13
May 9, 2023
Merged

[v13] Makefile: cache go env values#25894
marcoandredinis merged 1 commit intobranch/v13from
auto-backport/25870-to-branch/v13

Conversation

@marcoandredinis
Copy link
Copy Markdown
Contributor

Backport #25870 to branch/v13

Spawning shells is expensive for Makefile targets.
We use the `OS` and `ARCH` variables in a lot of places.
They come from spawning a subshell and then executing `go env GOOS` or
`go env GOARCH`.

So, everytime we need them, we spawn a subshells.
Just parsing the Makefile adds quite some time, even if the target
itself is fast.

This PR caches those values, so that we only need to spawn a subshell
once per execution.

Tests show that running `make print-version` is now much faster:
Using linux: drop from 56s to 0.240s
Using MacOS M1: drop from 291ms to 119ms
YMMV
@marcoandredinis marcoandredinis force-pushed the auto-backport/25870-to-branch/v13 branch from 47dccf9 to 15b69b0 Compare May 9, 2023 13:58
@github-actions github-actions Bot requested review from camscale and espadolini May 9, 2023 13:59
@marcoandredinis marcoandredinis changed the title Backport #25870 to branch/v13 [v13] Makefile: cache go env values May 9, 2023
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from camscale May 9, 2023 14:48
@marcoandredinis marcoandredinis added this pull request to the merge queue May 9, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 9, 2023
@marcoandredinis marcoandredinis added this pull request to the merge queue May 9, 2023
Merged via the queue into branch/v13 with commit 47ddde4 May 9, 2023
@marcoandredinis marcoandredinis deleted the auto-backport/25870-to-branch/v13 branch May 9, 2023 15:55
@r0mant r0mant mentioned this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants