@need 3200

@node Speeding up arch by Caching Revisions in Archives
@chapter Speeding up arch by Caching Revisions in Archives

This chapter will teach you one technique for speeding up access to an
@code{arch} archive.


Consider an @code{arch} version that contains many revisions:

@example
@group

@end group
@group
        mainline
        --------
        base-0
        patch-1
        ....
@end group
@group
        patch-23
        patch-24
        patch-25
        ...
        patch-42
@end group
@group


@end group
@end example

Suppose that a user (with no local pristine cache) wants to @code{get} the
@code{patch-42} revision.   @code{get} proceeds by first getting and unpacking
the @code{base-0} revision, then getting each @code{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 @code{get} is needlessly inefficient.


One way to speed up @code{get} is by @geindex archive caching revisions
@dfn{archive caching revisions} -- storing
"pre-built" copies of some revisions with the archive.


For example, the command:

@example
@group

@end group
@group
        % larch archive-cache-revision -A lord@@emf.net--2003-example \
                hello-world--mainline--0.1--patch-40
@end group
@group


@end group
@end example

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


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


@strong{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 @code{cron} job or to simply
cache revisions by-hand whenever you notice that @code{get} is too slow.
In the future, we hope to add better support for automatically caching
revisions.




