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

From: Ludovic Courtès <[email-masked]>
Date: Sat, 13 Jun 2020 21:32:37 +0200

Hi,

Arun Isaac <[email-masked]> skribis:

>>> * 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?

(To be clear, I’m referring specifically to this patch.)

> See my results from earlier.
>
> time ./pre-inst-env guix search game
>
> real	0m2.261s
> user	0m2.351s
> sys	0m0.104s
>
> time guix search game
>
> real	0m2.661s
> user	0m2.843s
> sys	0m0.080s
>
>> 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.

Yeah.  I feel like we shouldn’t have to do this, so I’d lean towards
excluding this patch from the series.  It’s too early to be confident
about it, but it might be something as discussed in
<https://lists.gnu.org/archive/html/guile-user/2020-06/msg00038.html>,
i.e., a problem to solve at the Guile level.

> 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)?

Yes, definitely!

Thank you,
Ludo’.