[Bug 230491] [patch] stat(1): Improve performance with getpwuid() and getgrgid() caching

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Aug 10 01:37:08 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230491

            Bug ID: 230491
           Summary: [patch] stat(1): Improve performance with getpwuid()
                    and getgrgid() caching
           Product: Base System
           Version: 11.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: tom at hur.st

Created attachment 196041
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=196041&action=edit
stat(1) caching (applies to STABLE and CURRENT)

This patch for stat(1) adds very simple caching to its calls to getpwuid() and
getgrgid(), for a substantial performance boost when user/group is displayed.

With this test command on a cached ZFS dataset:

    time (find /usr/src -type f -print0 | xargs -0 stat >/dev/null)

I see run time reduce from 22 seconds to 8.5 seconds.  On the OpenBSD CVS
repository with files owned by a normal user I see an even more pronounced
difference: 55 seconds reduced to 14 - I guess these functions have runtime
proportional to how far down the user/group lists they look?

sysutils/coreutils gnustat shows identical performance to stock FreeBSD
stat(1), so could probably benefit from similar changes.

Thanks to Vall on FreeNode #freebsd for reporting the performance problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list