[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
find, fts: dramatical improvement of speed in find
From: |
Askar Safin |
Subject: |
find, fts: dramatical improvement of speed in find |
Date: |
Thu, 23 Apr 2020 20:24:23 +0300 |
Hi. It seems you missed my letter. This time I CC'd gnulib/find devs. I have
gnulib/fts patch, which improves speed.
> Hi. I applied the following patch to fts.c from latest revision of gnulib (
> 47bf2cf3184027c1eb9c1dfeea5c5b8b2d69710d ):
>
> diff --git a/lib/fts.c b/lib/fts.c
...
>
> (If my mail client damaged this patch, you can see it here:
> http://paste.debian.net/hidden/c4eaca5b/ )
> Then I copied this patched fts.c to sources of "find" and "find" started to
> work significantly faster.
> Idea is this: if we are in FTS_LOGICAL mode, we don't need "stat" if we know
> this is not directory or symlink.
> Of course, I don't fully understand fts.c code, so, please, carefully review
> patch and make any needed additional changes (say, to comments).
>
> I got time decrease from 14.16 s to 9.21 s when searching in my home directory
> using this command:
>
> time -p sudo /tmp/sidabcn/root/findutils/find/find -O3 -L /home/user '(' -path
> '/home/user/Downloads' -o -path '*/.git' -o -path '*/Default' -o -path
> '*/dev/fd' -o -path '/home/user/opt' -o -path '*/node_modules' ')' -prune
> -false -o -type f > /tmp/st
>
> (Of course, I don't want to share my home dir, so you will not be able to
> reproduce my test, but you can still try to type something like "find -O3 -L
> /home")
>
> ==
> Askar Safin
> https://github.com/safinaskar
>
==
Askar Safin
https://github.com/safinaskar