Mercurial > hg
view mercurial/mpatch.h @ 49579:15a89b722937 stable
tags-fnode-cache: do not repeatedly open the filelog in a loop
While getting multiple hgtagsfnodecache entries, we were opening (and closing)
the `.hgtags` filelog for each iteration. The meant repeatedly reading and
parsing the version same information from disk. A quite costly operation.
We no longer do this, leading to a sizable improvement in `hg debugupdatecache`
run for an already warm repositories.
### data-env-vars.name = mercurial-2018-08-01-zstd-sparse-revlog
# benchmark.name = debug-update-cache
# benchmark.variants.pre-state = warm
before: 1.711778 seconds
after: 0.213229 seconds (-87.54%)
# data-env-vars.name = pypy-2018-08-01-zstd-sparse-revlog
before: 4.010817 seconds
after: 0.381141 seconds (-90.50%)
# data-env-vars.name = netbeans-2018-08-01-zstd-sparse-revlog
before: 13.574141
after: 1.023007 seconds (-92.46%)
# data-env-vars.name = mozilla-central-2018-08-01-zstd-sparse-revlog
before: 18.884656
after: 1.465735 seconds (-92.24%)
# data-env-vars.name = mozilla-try-2019-02-18-zstd-sparse-revlog
before: 88.924823
after: 6.511771 seconds (-92.68%)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 12 Nov 2022 02:38:26 +0100 |
parents | d86908050375 |
children |
line wrap: on
line source
#ifndef HG_MPATCH_H #define HG_MPATCH_H #define MPATCH_ERR_NO_MEM -3 #define MPATCH_ERR_CANNOT_BE_DECODED -2 #define MPATCH_ERR_INVALID_PATCH -1 struct mpatch_frag { int start, end, len; const char *data; }; struct mpatch_flist { struct mpatch_frag *base, *head, *tail; }; int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist **res); ssize_t mpatch_calcsize(ssize_t len, struct mpatch_flist *l); void mpatch_lfree(struct mpatch_flist *a); int mpatch_apply(char *buf, const char *orig, ssize_t len, struct mpatch_flist *l); struct mpatch_flist * mpatch_fold(void *bins, struct mpatch_flist *(*get_next_item)(void *, ssize_t), ssize_t start, ssize_t end); #endif