summaryrefslogtreecommitdiffstats
path: root/cmdline.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-02-29 18:35:55 -0500
committerTavian Barnes <tavianator@tavianator.com>2020-02-29 18:52:04 -0500
commit1c184e718f5745cf3a53a3c389814a792e73aa51 (patch)
tree0959d07a8e4ac507aefa4867156d144ce2eff1dd /cmdline.h
parent7fbf673ae2db33d6e47386bf3169d4b48f0fc8b4 (diff)
downloadbfs-1c184e718f5745cf3a53a3c389814a792e73aa51.tar.xz
passwd: Cache the user/group tables
This is a significant optimization for conditions that need these tables: Benchmark #1: ./bfs ~/code/linux -nouser >/dev/null Time (mean ± σ): 232.0 ms ± 2.5 ms [User: 44.3 ms, System: 185.0 ms] Range (min … max): 228.7 ms … 238.7 ms 12 runs Benchmark #2: ./bfs-1.6 ~/code/linux -nouser >/dev/null Time (mean ± σ): 1.050 s ± 0.012 s [User: 544.2 ms, System: 500.0 ms] Range (min … max): 1.025 s … 1.063 s 10 runs Benchmark #3: find ~/code/linux -nouser >/dev/null Time (mean ± σ): 1.040 s ± 0.012 s [User: 533.6 ms, System: 500.6 ms] Range (min … max): 1.017 s … 1.054 s 10 runs Summary './bfs ~/code/linux -nouser >/dev/null' ran 4.48 ± 0.07 times faster than 'find ~/code/linux -nouser >/dev/null' 4.52 ± 0.07 times faster than './bfs-1.6 ~/code/linux -nouser >/dev/null'
Diffstat (limited to 'cmdline.h')
-rw-r--r--cmdline.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmdline.h b/cmdline.h
index 6670696..422fc6c 100644
--- a/cmdline.h
+++ b/cmdline.h
@@ -63,6 +63,15 @@ struct cmdline {
/** Colored stderr. */
CFILE *cerr;
+ /** User table. */
+ struct bfs_users *users;
+ /** The error that occurred parsing the user table, if any. */
+ int users_error;
+ /** Group table. */
+ struct bfs_groups *groups;
+ /** The error that occurred parsing the group table, if any. */
+ int groups_error;
+
/** Table of mounted file systems. */
struct bfs_mtab *mtab;
/** The error that occurred parsing the mount table, if any. */