Subject: bug#69775: [PATCH] Use regexp-opt in dired-omit-regexp

From: Eli Zaretskii <[email-masked]>
Date: Thu, 14 Mar 2024 13:00:00 +0200

> From: Spencer Baugh <[email-masked]>
> Date: Wed, 13 Mar 2024 11:01:05 -0400
> 
> In my benchmarking, for large dired buffers, using regexp-opt provides
> around a 3x speedup in omitting.

Can you show a recipe for such benchmarking?  I'd like to try that on
my systems.

Also, what is the slowdown in the (improbable, but possible) case
where dired-omit-extensions change for each call of dired-omit-regexp?

> regexp-opt takes around 5 milliseconds, so to avoid slowing down
> omitting in small dired buffers we cache the return value.
> 
> Since omitting is now 3x faster, increase dired-omit-size-limit by 3x.
> 
> * lisp/dired-x.el (dired-omit--extension-regexp-cache): Add.
> (dired-omit-regexp): Use regexp-opt.
> (dired-omit-size-limit): Increase, since omitting is now faster.

I'm okay with these changes, but:

  . the change in the default value of dired-omit-size-limit should be
    called out in NEWS
  . please document this variable in the dired-x.texi manual, where we
    document all the other variables relevant to dired-omit mode.
  . the doc string of dired-omit-size-limit is embarrassingly
    unhelpful, so bonus points for fixing that as well

Thanks.