#980076 command-not-found: Patch to speed up cnf-update-db

#980076#5
Date:
2021-01-14 02:23:27 UTC
From:
To:
Dear Maintainer,

cnf-update-db is fairly slow on my machine. After I remove
/var/lib/command-not-found/commands.db.metadata, cnf-update-db takes about 16
seconds on my machine.

A large chunk of this time is checking whether files are in /usr/bin and
similar directories. I'm attaching a small patch that optimizes this check,
taking the same update down to about 10 seconds on my machine. It's a 4-line
change that seems like an easy win.

I confirmed that I have the same number of commands and packages in the
commands.db database with and without this change.

Please let me know if you prefer to receive this patch in a different format or
channel.

Regards,
Diego