Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Aug 2018 01:37:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 230491] [patch] stat(1): Improve performance with getpwuid() and getgrgid() caching
Message-ID:  <bug-230491-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

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@FreeBSD.org
          Reporter: tom@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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-230491-227>