[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: trying to optimize find's searches ...



Hello Albretch,

On Sat, Mar 5, 2016 at 6:23 AM, Albretch Mueller <lbrtchx@gmail.com> wrote:
> find works significantly faster when you bag various search patterns á la:
>
> -iname '*.ko' -or -iname '*.bin' -or -iname '*.txt'
>
> but, how could you do that using a batch strategy and setting a
> variable with many "-[i]name ... -or -[i]name ..." cases?
>
> line-by-line strategies are too slow

I'm not sure what are you saying, but maybe you can play with locate
and updatedb commands (from mlocate package)

See:

$ function clean { sudo sync; echo 3 | sudo tee
/proc/sys/vm/drop_caches &> /dev/null ; } # so cache fs not count on
your test

$ clean ; time locate --regex '\.(ko|bin|txt)$' &> /dev/null

real 0m1.666s
user 0m0.592s
sys 0m0.164s

$ clean; time ( sudo find  / -iname '*.ko' -or -iname '*.bin' -or
-iname '*.txt' &> /dev/null)

real 0m57.579s
user 0m11.264s
sys 0m11.000s

See "man updatedb locate" and /etc/cron.daily/mlocate

Regards,


Reply to: