diff options
author | Dan McGee <dan@archlinux.org> | 2011-12-30 12:17:52 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-01-02 12:55:55 -0600 |
commit | 819c28bf8c666a61ef3b0a016dcbd6962ecaf4e4 (patch) | |
tree | 7f6f9ba221cf7aa40daad40063a9110ddaecc20f /lib/libalpm/delta.h | |
parent | 627cf6bca88c241d7e0d5563db46f87f64792653 (diff) | |
download | pacman-819c28bf8c666a61ef3b0a016dcbd6962ecaf4e4.tar.xz |
Only compile delta regex once
This reduces the number of regcomp() calls when parsing delta entries in
the database from once per entry to once for the entire context handle
by storing the compiled regex data on the handle itself. Just as we do
with the cURL handle, we initialize it the first time it is needed and
free it when releasing the handle.
A few other small tweaks to the parsing function also take place,
including using the stack to store the transient and short file size
string while parsing it.
When parsing a sync database with 1378 delta entries, this reduces the
time of a `pacman -Sl deltas` operation by 50% from 0.22s to 0.12s.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/delta.h')
-rw-r--r-- | lib/libalpm/delta.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/delta.h b/lib/libalpm/delta.h index 42353f5f..1173ddfe 100644 --- a/lib/libalpm/delta.h +++ b/lib/libalpm/delta.h @@ -24,7 +24,7 @@ #include "alpm.h" -alpm_delta_t *_alpm_delta_parse(char *line); +alpm_delta_t *_alpm_delta_parse(alpm_handle_t *handle, const char *line); void _alpm_delta_free(alpm_delta_t *delta); alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta); off_t _alpm_shortest_delta_path(alpm_handle_t *handle, alpm_list_t *deltas, |