summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/bsdtar.h
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-04-14 00:40:54 +0000
committerkientzle <kientzle@FreeBSD.org>2004-04-14 00:40:54 +0000
commit58455f9e3f869c3180a82c968b65beffd5360d9b (patch)
tree419a64b2cade5669e5239f3d935c89f641683b46 /usr.bin/tar/bsdtar.h
parent36be62a85e57cc41d82b559f10f52e78a1272f4e (diff)
downloadFreeBSD-src-58455f9e3f869c3180a82c968b65beffd5360d9b.zip
FreeBSD-src-58455f9e3f869c3180a82c968b65beffd5360d9b.tar.gz
A simple cache of uid->uname lookups and gid->gname lookups eliminates
almost 1/2 of the CPU time required to create an uncompressed archive and makes a noticable reduction in wallclock time.
Diffstat (limited to 'usr.bin/tar/bsdtar.h')
-rw-r--r--usr.bin/tar/bsdtar.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/usr.bin/tar/bsdtar.h b/usr.bin/tar/bsdtar.h
index dd37326..f11f451 100644
--- a/usr.bin/tar/bsdtar.h
+++ b/usr.bin/tar/bsdtar.h
@@ -77,6 +77,20 @@ struct bsdtar {
struct links_entry *links_head;
struct archive_dir_entry *archive_dir_head, *archive_dir_tail;
+
+ /* An arbitrary prime number. */
+ #define bsdtar_hash_size 71
+ /* A simple hash of uid/uname for caching uname lookups. */
+ struct {
+ uid_t uid;
+ char *uname;
+ } uname_lookup[bsdtar_hash_size];
+
+ /* A simple hash of gid/gname for caching gname lookups. */
+ struct {
+ gid_t gid;
+ char *gname;
+ } gname_lookup[bsdtar_hash_size];
};
const char *bsdtar_progname(void);
OpenPOWER on IntegriCloud