.dockerignore, Dockerfile: add a zig cache#59
Conversation
This seems like a 2.6x speedup when running a subsequent exercise test,
at the cost of adding a 45 MB zig cache to the image:
33 MB /root/.cache/zig/z/
12 MB /root/.cache/zig/o/
22 kB /root/.cache/zig/h/
Closes: exercism#28
Initialize the cache by using the exact same process that runs an exercise solution in production.
The previous approach doesn't produce an error at build time if the tests fail.
|
I ran the tests for Let's see if it improves after merging. |
|
Starting at Edit: same thing at @ErikSchierboom do we already have a process for comparing an exercise's test execution time across two different test runner images? If so, can you reproduce the above slow down? I'm certain it's a large speedup for me locally. But if it seems to be legitmately worse in production, I'll revert the commit. I realize there's some noise in the measurement. |
I'm afraid we don't, sorry. |
Running the tests for a Zig exercise was much slower than it should be, because every test run was the first time that Zig was run in the image.
Let's try an initial simple approach: run
zig testonce (fortests/example-success) and copy the resulting zig cache into the Docker image. This seems like a 2.2x speedup when running a subsequent exercise test, at the cost of adding a 41 MB zig cache to the image:Edit: Later, I believe we can speedup further by caching the result of compiling more functions from
std.testing.The speedup was better with the
hello-worldfiles because we cachedtesting.expectEqualStrings. But let's add a different test file in a follow-up PR that uses a bunch of common functions.Closes: #28
This is sufficient to produce a significant speedup locally (from about 5 seconds to 2.3 seconds). And I think it's sufficient to produce the same significant speedup in production, but I'm not certain. I think it's easiest to just measure the approximate duration of a test run from the online editor before merging, merge, and test again after deploying.
Instead of adding thehello-worldfiles to this repo, we could fetch them from the track repo at build time. But I think I'd rather avoid the extra network request.To-do:
hello-worldfiles, consider initializing the cache by testing an existing file in the tests directoryzig-test-runner/tests/example-success/example_success.zig
Lines 1 to 3 in 9d7c3f2