Seabright Technology Header Image

Faster archiving of GCC by doing less

We squirrel away the results of each Linaro GCC auto build so that they can be used for later benchmarking, testing, or regression hunting. This was taking around 25 minutes on a PandaBoard which, even on a 16 hour build, is too long.

The old method was:

  • Install to $build/install
  • Copy $build/install to gcc-linaro-$version-$buildid so the tarball had a unique top directory
  • Tar up without compression
  • Use xz at a non-default level to make the final .tar.xz

The new method skips the intermediate tarball by setting the compression level through the environment, and skips the copy by using tar’s transform rules to rewrite the top level directory:

XZ_OPT=-2 \
tar cJf $(B)/$(ARCHIVE_BASE)-$(SNAME)$(SUFFIX).tar.xz \
-C $(VBUILD)/install \
--transform "s,^\./,$(ARCHIVE_BASE)-$(SNAME)$(SUFFIX)/," \
.

This cuts the archive down to 4:20 by skipping a lot of disk I/O, reducing the time spent compressing, and compressing and tarring in parallel.

xz is impressive. At the lowest ‘-1′ compression level it takes the same time as gzip but produces an archive 65 % of the size. I settled on ‘-2′ which gives an archive 15 % bigger than the default ‘-6′ but takes a quarter of the time.

Leave a Reply