Subject: [bug#39258] [PATCH 2/4] ui: Use string matching with literal search strings.

From: Arun Isaac <[email-masked]>
Date: Sat, 13 Jun 2020 18:07:45 +0530

>> * guix/scripts/package.scm (process-query): Make search query a regexp only if
>> it is not a literal search string.
>> * guix/ui.scm (relevance): Use string matching with literal search strings and
>> regexp matching with regexp search strings.
>
> How does this affect performance?

See my results from earlier.

--8<---------------cut here---------------start------------->8---
time ./pre-inst-env guix search game

real	0m2.261s
user	0m2.351s
sys	0m0.104s
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
time guix search game

real	0m2.661s
user	0m2.843s
sys	0m0.080s
--8<---------------cut here---------------end--------------->8---

> I would expect the regexp engine in libc to do something similar
> internally, so I wonder if the extra work in Scheme pays off.

I agree it would better to do this optimization at the regexp engine, if
it doesn't do it already.

So, shall I push the remaining patches (patches 1, 3, 4) after applying
the change you suggested for patch 1 (use of if versus cond)?