git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/5] Use kwset in grep

From
Fredrik Kuivinen <frekui@gmail.com>
Date
Feb 14, 2010, 16:51 UTC
Message-ID
<4c8ef71002140851hff65a2bj7cc31c634ce5bab3@mail.gmail.com>
In-Reply-To
<4B76E384.2070602@gnu.org>
On Sat, Feb 13, 2010 at 18:38, Paolo Bonzini <bonzini@gnu.org> wrote:
Show 34 quoted lines
> On 02/13/2010 03:21 PM, Fredrik Kuivinen wrote:
>>
>> Best of five runs in the linux repository:
>>
>> before:
>>
>> $ time git grep qwerty
>> drivers/char/keyboard.c:        "qwertyuiop[]\r\000as"
>>      /* 0x10 - 0x1f */
>>
>> real    0m1.065s
>> user    0m1.400s
>> sys     0m0.536s
>>
>>
>> after:
>>
>> $ time git grep qwerty
>> drivers/char/keyboard.c:        "qwertyuiop[]\r\000as"
>>      /* 0x10 - 0x1f */
>>
>> real    0m0.621s
>> user    0m0.560s
>> sys     0m0.564s
>>
>> So we gain about 40% by using the kwset code.
>
> Hmm, on a more accurate review for
>
>    git grep -e foo -e bar
>
> you're creating two kwsets, so a Boyer-Moore search be much simpler---the
> performance would be the same since that's what kwset degrades to for a
> single string, but you'd probably save around 600 lines of code...

Another approach is to just create a single kwset for this case as well. I will try that in the next iteration.

- Fredrik
Previous: Paolo Bonzini
Message 11 of 11 in “Add obstack.[ch] from EGLIBC 2.10”
  1. 1/5 Add obstack.[ch] from EGLIBC 2.10Fredrik Kuivinen, Feb 13, 2010
  2. 2/5 Add string search routines from GNU grepFredrik Kuivinen, Feb 13, 2010
  3. Dmitry PotapovFeb 13, 2010
  4. Paolo BonziniFeb 13, 2010
  5. Fredrik KuivinenFeb 14, 2010
  6. 3/5 Adapt the kwset code to GitFredrik Kuivinen, Feb 13, 2010
  7. 4/5 Use kwset in pickaxeFredrik Kuivinen, Feb 13, 2010
  8. 5/5 Use kwset in grepFredrik Kuivinen, Feb 13, 2010
  9. Paolo BonziniFeb 13, 2010
  10. Paolo BonziniFeb 13, 2010
  11. Fredrik KuivinenFeb 14, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.