]> git.ipfire.org Git - thirdparty/coreutils.git/commit
df: improve performance with many mount points
authorPhilipp Thomas <pth@suse.de>
Sun, 31 Jul 2016 19:24:18 +0000 (21:24 +0200)
committerPádraig Brady <P@draigBrady.com>
Wed, 3 Aug 2016 11:35:47 +0000 (12:35 +0100)
commit1c17f61ef993a5ee5fb0d3bc47b7b25782ae386c
treec7cad95c57fcea30076a9afd44935f9b3d2419e9
parent5bbce2d2d76edc24caf0888888a1e20cf23151ef
df: improve performance with many mount points

Use hash table for seaching in filter_mount_list() and get_dev()

This improves performance for 20K mount entries from:
  real    0m1.731s
  user    0m0.532s
  sys     0m1.188s
to:
  real    0m1.066s
  user    0m0.028s
  sys     0m1.032s

* src/df.c (devlist_table): Define hash table.
(devlist_hash): Add hash function.
(devlist_compare): Add hash comparison function.
(devlist_for_dev): Add lookup function.
(devlist_free): Add cleanup function.
(filter_mount_list): Use the above hash table.
While at it, rename the variable 'devlist' to 'seen_dev' for
better readability.
(me_for_dev): Use the above lookup function.
NEWS: Mention the improvement.
THANKS.in: Remove the committer; add original submitter Josef Cejka.
NEWS
THANKS.in
src/df.c