[Bug 207022] stat() 4 to 16 times slower on FreeBSD/UFS than on Linux/Ext4

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Feb 10 01:28:37 UTC 2016


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

--- Comment #13 from Steven Hartland <smh at FreeBSD.org> ---
How much time is this really using when testing here with
== gen ==
perl -e 'for (1..4200) {my $file = "file$_";open(my $fh, ">", $file) or die
"cannot open > $file: $!";}'
/== gen ==

== bin ==
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <err.h>
#include <sysexits.h>

int main(int argc, char* argv[])
{
        struct stat buf;
        char name[1024];
        int i;

        for (i = 1; i <= 4200; i++) {
                sprintf(name, "file%d", i);
                if (stat(name, &buf) != 0) {
                        printf("Tested %d files\n", i - 1);
                        err(EX_OSERR, NULL);
                }
        }
        printf("Tested %d files\n", i - 1);
}
/== bin ==
I'm seeing:
/usr/bin/time ./test
Tested 4201 files
        0.00 real         0.00 user         0.00 sys

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


More information about the freebsd-fs mailing list