Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Comparing the use of apt-get vs apt-fast for installing packages in Debian
# A standard Debian container extended with apt-fast (
FROM debian
LABEL maintainer=""
# Install gnupg to allow apt-key verification, time to allow profiling
RUN apt-get update
RUN apt-get install -y gnupg time
# Set up PPA for apt-fast
RUN echo deb bionic main >> /etc/apt/sources.list.d/apt-fast.list \
&& echo deb-src bionic main >> /etc/apt/sources.list.d/apt-fast.list
RUN apt-key adv --keyserver --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B
RUN apt-get update
# Configure apt-fast installation to avoid prompts
RUN echo debconf debconf/frontend select Noninteractive | debconf-set-selections
RUN echo apt-fast apt-fast/maxdownloads string 10 | debconf-set-selections
RUN echo apt-fast apt-fast/dlflag boolean true | debconf-set-selections
RUN echo apt-fast apt-fast/aptmanager string apt-get | debconf-set-selections
# Install apt-fast
RUN apt-get install -y apt-fast
benchmark: apt-get-timing.log apt-fast-timing.log
@echo apt-get results:
@tail -n 1 apt-get-timing.log
@echo apt-fast.log
@tail -n 1 apt-fast-timing.log
docker build -t apt-fast .
apt-get-timing.log: build
docker run --rm apt-fast time --format=%E apt-get install -y --no-install-recommends $(PACKAGES) > apt-get.log 2> apt-get-timing.log
apt-fast-timing.log: build
docker run --rm apt-fast time --format=%E apt-fast install -y --no-install-recommends $(PACKAGES) &> apt-fast.log 2> apt-fast-timing.log

This comment has been minimized.

Copy link
Owner Author

@ryanwilsonperkin ryanwilsonperkin commented Mar 12, 2019

Use it like this:

# Builds a Docker image with apt-fast, benchmarks the installation speed for the gcc package with both apt-get and apt-fast
$ make
# ... output trimmed ...
apt-get results:

# Alternatively, customize the packages to try benchmarking by setting a PACKAGES variable
$ PACKAGES="ffmpeg imagemagick python wget" make
# ... output trimmed ...
apt-get results:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.