Skip to content

Instantly share code, notes, and snippets.

@lynaghk
Last active July 22, 2022 18:52
Show Gist options
  • Save lynaghk/0f9b66cf889398a7c73b01f39beaffee to your computer and use it in GitHub Desktop.
Save lynaghk/0f9b66cf889398a7c73b01f39beaffee to your computer and use it in GitHub Desktop.
earthly vs toast

Comparing Earthly and Toast for isolated / repeatable development.

Calculate a performance floor by running a fast command, echo, in the context of a large container (the emscripten SDK takes up about 1 GB).

After the initial build and caching, Toast takes 800ms and Earthly about 7 seconds on my 2020 M1 Macbook Air.

  • MacOS 12.5
  • Docker Desktop 4.10.1
  • Toast 0.45.5
  • Earthly v0.6.20 ad869c06c884b10f88948b5852ab22b4d7262e20

Toast output

$ time toast hello
[INFO] Ready to run 1 task: hello.
[INFO] Running task hello…
toast hello  0.29s user 0.13s system 50% cpu 0.827 total

Earthly output

$ time earthly --verbose +hello                                                                                 

 1. Init πŸš€
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

           buildkitd | Found buildkit daemon as docker container (earthly-buildkitd)
           buildkitd | Comparing running container image ("sha256:644fb4ca18c832026baff8e95234d55c97628446fd9f99a22a3733814cab21eb") with available image ("sha256:644fb4ca18c832026baff8e95234d55c97628446fd9f99a22a3733814cab21eb")
           buildkitd | Settings hashes match ("c919e39463a37848"), no restart required
           buildkitd | Version github.com/earthly/buildkit v0.6.20 a2a3e382a7782588b741932d7ee9484358bac157
           buildkitd | Platforms: linux/arm64 (native) linux/amd64 linux/amd64/v2 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/mips64le linux/mips64 linux/arm/v7 linux/arm/v6
           buildkitd | Utilization: 0 other builds, 0/20 op load
           buildkitd | GC stats: 2.0 GB cache, avg GC duration 0s, all-time GC duration 3ms, last GC duration 0s, last cleared 0 B


 2. Build πŸ”§
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

       internal-term | connecting to shellrepeater on 127.0.0.1:8373
ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c | --> Load metadata linux/arm64
ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c | Completed in 3.989541ms
               +base | --> FROM ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c
             context | --> local context .
             context | Completed in 29.375Β΅s
               +base | [          ]   0% resolve docker.io/library/ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c
               +base | [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] 100% resolve docker.io/library/ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c
             ongoing | context (5 seconds ago)
             context | [          ]   0% transferring .:
             context | [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] 100% transferring .:
             context | Completed in 5.027224294s
               +base | *cached* --> WORKDIR /test
               +base | Completed in 0s
              +emsdk | *cached* --> COPY install_emsdk.sh .
              +emsdk | Completed in 0s
              +emsdk | *cached* --> RUN ./install_emsdk.sh
              +emsdk | Completed in 0s
              +hello | *cached* --> RUN echo 'hello' > my_output
              +hello | Completed in 80Β΅s
              +hello | *cached* --> SAVE ARTIFACT my_output +hello/my_output AS LOCAL my_output
              +hello | Completed in 97.791Β΅s
              output | --> exporting outputs
              output | [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] 100% copying files
              output | Completed in 16.565209ms
Summary of timing information
Note that the times do not include the expansion of commands like BUILD, FROM, COPY (artifact).
             context | () 5.027253669s
              output | () 16.565209ms
ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c | () 3.989541ms
               +base | () 3.822125ms
              +hello | () 177.791Β΅s
===============================================================
Total       	5.051808335s
Total (real)	5.189109375s


 3. Push ⏫ (disabled)
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

To enable pushing use

		earthly --push ...



 4. Local Output 🎁
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

Artifact g/incubator/container-workflow-test:master+hello/my_output output as my_output


========================== 🌍 Earthly Build  βœ… SUCCESS ==========================

Share your logs with an Earthly account (experimental)! Register for one at https://ci.earthly.dev.
retrying http request due to unexpected error Put "https://api.earthly.dev/analytics": dial tcp 100.20.164.62:443: connect: bad file descriptor
Warning: timedout while sending analytics
earthly --verbose +hello  0.64s user 0.43s system 14% cpu 7.275 total
VERSION 0.6
FROM ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c
WORKDIR /test
hello:
FROM +emsdk
RUN echo 'hello' > my_output
SAVE ARTIFACT my_output AS LOCAL my_output
emsdk:
COPY install_emsdk.sh .
RUN ./install_emsdk.sh
#!/usr/bin/env bash
set -euo pipefail
EMSDK_VERSION=3.1.9
apt-get update
apt-get -qq install -y --no-install-recommends binutils build-essential ca-certificates wget file python3
rm -rf /var/lib/apt/lists/*
wget -O emsdk.tar.gz https://github.com/emscripten-core/emsdk/archive/refs/tags/${EMSDK_VERSION}.tar.gz
tar xzf emsdk.tar.gz
rm emsdk.tar.gz
cd emsdk-${EMSDK_VERSION}
./emsdk install ${EMSDK_VERSION}
./emsdk activate ${EMSDK_VERSION}
image: ubuntu:20.04@sha256:c01a10535d9ea3e4065dee4abdb288821b2918929f1e1584287a03e731b9176c
command_prefix: set -euo pipefail
tasks:
hello:
cache: false
command: echo "hello world" > my_output
output_paths:
- my_output
install_emsdk:
input_paths:
- install_emsdk.sh
command: ./install_emsdk.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment