Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 1.20 fast #103

Merged
merged 8 commits into from
Mar 23, 2023
Merged

Make 1.20 fast #103

merged 8 commits into from
Mar 23, 2023

Conversation

andrerfcsantos
Copy link
Member

@andrerfcsantos andrerfcsantos commented Mar 18, 2023

Follow up of: https://forum.exercism.org/t/tests-failing-with-an-error-occurred/4616/11


After trying several things (which I included in the forum thread), removing the special user and the GOCACHE env var fixed the problem. Both these changes seem to be necessary, also tried one without the other, and the problem persists.

I'm still not sure why this fixes it. My best guess is these two bits of the 1.20 Release Notes:

The packages in the standard library that use cgo are net, os/user, and plugin. On macOS, the net and os/user packages have been rewritten not to use cgo: the same code is now used for cgo and non-cgo builds as well as cross-compiled builds. On Windows, the net and os/user packages have never used cgo. On other systems, builds with cgo disabled will use a pure Go version of these packages.

My guess here is that running the test runner as a special user inside the container makes Go call the os/user package. Setting CGO_ENABLED=1 to explicitly enable cgo also seems to do nothing in this regard.

(In module mode, compiled packages are stored in the build cache only, but a bug had caused the GOPATH install targets to unexpectedly remain in effect.)

We do compile the user solution in module mode, which uses the build cache set by GOCACHE, but it seems using /tmp causes slowness, and letting the default Go uses is best.

@coveralls
Copy link

coveralls commented Mar 18, 2023

Pull Request Test Coverage Report for Build 4500226192

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.6%) to 64.952%

Totals Coverage Status
Change from base Build 4447602566: 0.6%
Covered Lines: 404
Relevant Lines: 622

💛 - Coveralls

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant changes are in this file

@andrerfcsantos andrerfcsantos marked this pull request as ready for review March 18, 2023 00:22
@andrerfcsantos andrerfcsantos requested a review from a team as a code owner March 18, 2023 00:22
@iHiD
Copy link
Member

iHiD commented Mar 18, 2023

❤️ 🧡 💛 💚 💙 💜 🖤

Dockerfile Show resolved Hide resolved
Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works well on my machine. Let's keep an eye out once we merge this

@andrerfcsantos
Copy link
Member Author

It seems this is an issue with the build cache (see discussion in golang/go#59146).

For that reason, I included a command to populate the build cache with the std lib and other packages related with go commands. This makes the initial build of the container a bit slower, but ensures the build cache is populated, meaning we should see more consistent builds.

I plan on merging tomorrow when I have more time to monitor the test runs.

@ErikSchierboom
Copy link
Member

For that reason, I included a command to populate the build cache with the std lib and other packages related with go commands. This makes the initial build of the container a bit slower, but ensures the build cache is populated, meaning we should see more consistent builds.

We use the same approach in several other test runners.

@andrerfcsantos andrerfcsantos merged commit 35f10f2 into exercism:main Mar 23, 2023
@andrerfcsantos andrerfcsantos deleted the make-1.20-fast branch March 23, 2023 11:54
@ErikSchierboom
Copy link
Member

I tested use one of my Go solutions and that looked fine performance wise

@andrerfcsantos
Copy link
Member Author

Same here. Tested in a variety of exercises and looks great.

Maybe even faster than before?

@ErikSchierboom
Copy link
Member

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants