Skip to content

Instantly share code, notes, and snippets.

Embed
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 (https://github.com/ilikenwf/apt-fast/)
FROM debian
LABEL maintainer="rwilsonperkin@waveapps.com"
# 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 http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main >> /etc/apt/sources.list.d/apt-fast.list \
&& echo deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main >> /etc/apt/sources.list.d/apt-fast.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --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
PACKAGES ?= gcc
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
build:
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
@ryanwilsonperkin

This comment has been minimized.

Copy link
Owner Author

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:
0:02.69
apt-fast.log
0:03.47

# Alternatively, customize the packages to try benchmarking by setting a PACKAGES variable
$ PACKAGES="ffmpeg imagemagick python wget" make
# ... output trimmed ...
apt-get results:
0:22.69
apt-fast.log
0:23.47
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.