The Hackerlab at `regexps.com`

## Speeding up arch by Caching Revisions in Archives

up: arch Meets hello-world next: The arch Changeset Format prev: Driving Process Automation with arch Hooks

This chapter will teach you one technique for speeding up access to an `arch` archive.

Consider an `arch` version that contains many revisions:

            mainline
            --------
            base-0
            patch-1
            ....
            patch-23
            patch-24
            patch-25
            ...
            patch-42

Suppose that a user (with no local pristine cache) wants to `get` the `patch-42` revision. `get` proceeds by first getting and unpacking the `base-0` revision, then getting each `patch-<N>` changeset, in order, and applying those to the tree.

If the list of changesets that need to be applied is long, or the sum of their sizes large in comparison to the tree side, then this implementation of `get` is needlessly inefficient.

One way to speed up `get` is by archive caching revisions -- storing "pre-built" copies of some revisions with the archive.

For example, the command:

            % tla cacherev -A lord@emf.net--2003-example \
                    hello-world--mainline--0.1--patch-40

will build the `patch-40` revision, package it up as a tar bundle, and store a copy of that tar bundle in the `patch-40` directory of the archive.

Subsequently, a `get` of `patch-42` will work by first fetching the cached copy of the `patch-40` revision, then getting and applying the changesets for `patch-41` and `patch-42` : a savings of `40` changesets.

Usage Note: At this time, it's left up to you to decide which revisions to cache and which not. You might decide, for example, to automatically cache certain revisions from a `cron` job or to simply cache revisions by-hand whenever you notice that `get` is too slow. In the future, we hope to add better support for automatically caching revisions.

arch Meets hello-world: A Tutorial Introduction to The arch Revision Control System
The Hackerlab at `regexps.com`