Skip to content

Commit

Permalink
Fix grammar issues in best-practices.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tasxatzial committed Oct 2, 2024
1 parent e5fa88b commit 57d3756
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions building/tooling/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ See the [network docs](/docs/building/tooling/docker#network) for more informati

### Prefer build-time commands over run-time commands

Tooling runs as one-off, short-lived Docker container:
Tooling runs as a one-off, short-lived Docker container:

1. A Docker container is created
2. The Docker container is run with the correct arguments
3. The Docker container is destroyed

Therefore, code that runs in step 2 runs for _every single tooling run_.
For this reason, reducing the amount of code that runs in step 2 is a great way to improve performance
For this reason, reducing the amount of code that runs in step 2 is a great way to improve performance.
One way of doing this is to move code from _run-time_ to _build-time_.
Whilst run-time code runs on every single tooling run, build-time code only runs once (when the Docker image is built).

Expand All @@ -72,7 +72,7 @@ RUN stack build --resolver lts-20.18 --no-terminal --test --no-run-tests
```

First, the `pre-compiled` directory is copied into the image.
This directory is setup as a sort of fake exercise and depends on the same base libraries that the actual exercise depend on.
This directory is set up as a sort of fake exercise and depends on the same base libraries that the actual exercise depends on.
Then we run the tests on that directory, which is similar to how tests are run for an actual exercise.
Running the tests will result in the base being compiled, but the difference is that this happens at _build time_.
The resulting Docker image will thus have its base libraries already compiled, which means that no longer has to happen at _run time_, resulting in (much) faster execution times.
Expand Down

0 comments on commit 57d3756

Please sign in to comment.