# Applying git technology to fix the locate command

2 messages from 2012-10-07 to 2012-10-07. Participants: jonsmirl@gmail.com.
Thread: https://gitlist.dev/t/31743

## jonsmirl@gmail.com, 2012-10-07 18:39

Subject: Applying git technology to fix the locate command
Message-ID: <CAKON4OzyAt-e0Ygj=7+Ze7ywU+RNTsi-Nn5huCnEWy8o=a-EUA@mail.gmail.com>
URL: https://gitlist.dev/e/CAKON4OzyAt-e0Ygj%3D7%2BZe7ywU%2BRNTsi-Nn5huCnEWy8o%3Da-EUA%40mail.gmail.com

```
I've been using the Dash HUD in Ubuntu and it's performance is
terrible to the point of being unusable. So I started top and noticed
that it was forking 'locate' and locate was pegging my CPU at 100%
while I tried typing into their incremental search.

Next I looked at the mlocate database. It is 350MB on my desktop and
indexing 10,388,379 files. Not quite sure why I have 10M files on my
desktop - probably because links are making files appear multiple
times.

Typing a non-existent string into locate takes over 10s to respond and
that's with the db cached in RAM.

jonsmirl@terra:/$ time locate lelelekddmd
real	0m10.645s
user	0m10.537s
sys	0m0.064s

Git has to deal with similar path compression and it responds pretty
much instantly. I'm wondering if any of you git gurus could apply some
knowledge from git and use it to fix locate?

-- 
Jon Smirl
jonsmirl@gmail.com

```

## jonsmirl@gmail.com, 2012-10-07 19:18

Subject: Re: Applying git technology to fix the locate command
Message-ID: <CAKON4OwRuEhaHhCkv6oS+wL1NEp-3DyWcYbRqq5=RKuqgs8f0g@mail.gmail.com>
URL: https://gitlist.dev/e/CAKON4OwRuEhaHhCkv6oS%2BwL1NEp-3DyWcYbRqq5%3DRKuqgs8f0g%40mail.gmail.com
In-Reply-To: <CAKON4OzyAt-e0Ygj=7+Ze7ywU+RNTsi-Nn5huCnEWy8o=a-EUA@mail.gmail.com>

```
I played around with updatedb.conf to exclude .git files and my
/exports directory. I got the db down to 136MB and 4.5s for a null
search.  This command still needs help.  Given that I have the entire
db file cached it should be able to respond instantly on a null
search.

-- 
Jon Smirl
jonsmirl@gmail.com

```
