public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Guo, Wangyang" <wangyang.guo@intel.com>
To: "H.J. Lu" <hjl.tools@gmail.com>,
	Amit Choudhary <amitchoudhary0523@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: RE: Fastest String Search Algorithm.
Date: Wed, 9 Jun 2021 05:33:41 +0000	[thread overview]
Message-ID: <DM5PR11MB15774A5725082B2A0473D2EF92369@DM5PR11MB1577.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAMe9rOrH3FH4kpz5PUCe0ABL0JOrg9x1S4U29tqKyuTHu71K9Q@mail.gmail.com>

I have tried to convert Amit's algorithm in C and benchmark with bench-strstr.
The result shows no advantage compared to existing implementations.

BR
Wangyang

-----Original Message-----
From: H.J. Lu <hjl.tools@gmail.com> 
Sent: Sunday, June 6, 2021 10:30 PM
To: Amit Choudhary <amitchoudhary0523@gmail.com>; Guo, Wangyang <wangyang.guo@intel.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: Fastest String Search Algorithm.

On Sun, Jun 6, 2021 at 7:15 AM Amit Choudhary via Libc-alpha <libc-alpha@sourceware.org> wrote:
>
> Hi All,
>
> I have invented the fastest string search algorithm. It is called 
> "Choudhary Algorithm". I am sharing it here, in case glibc wants to 
> include it in for strstr().

We have been trying to improve strstr in glibc:

https://gitlab.com/x86-glibc/glibc/-/merge_requests/46

But we couldn't find a solution which is fast for all cases.
Wangyang, please work
with Amit to improve strstr in glibc.

> I have compared my algorithm my other standard algorithms and below 
> are the results.
>
> You can view the results and source code of the algorithm and 
> text/pattern
> here: 
> https://sourceforge.net/projects/fastest-string-search-algo/files/
>
> The search text is around 60 KB long and the pattern is 27 bytes.
>
> Result:
> ---------
>
> Pattern found at index 30384
>
> Time taken by Brute Force algorithm = 57,151,900 ns.
> Time taken by Boyer Moore algorithm = 25,012,100 ns.
> Time taken by Rabin Karp algorithm = 613,410,200 ns.
> Time taken by Knuth Morris Pratt Force algorithm = 58,461,200 ns.
> Time taken by Choudhary algorithm = 17,413,000 ns. (Fastest).
>
> Choudhary string search algorithm is the fastest.
>
> ----------------------------------------------------------------------
> ---------
>
> Regards,
> Amit

Thanks.

--
H.J.

  parent reply	other threads:[~2021-06-09  5:33 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 14:15 Amit Choudhary
2021-06-06 14:30 ` H.J. Lu
2021-06-06 18:38   ` Amit Choudhary
2021-06-09  5:33   ` Guo, Wangyang [this message]
2021-06-09  6:18     ` Amit Choudhary
2021-06-09  6:50       ` Siddhesh Poyarekar
2021-06-09  7:38       ` Phil Blundell
2021-06-09  7:54         ` Amit Choudhary
2021-06-09  9:26           ` Phil Blundell
2021-06-06 17:58 ` Paul Eggert
2021-06-06 18:26   ` Amit Choudhary
2021-06-07 11:48     ` Amit Choudhary
2021-06-07 20:12       ` Paul Eggert
2021-06-07 10:53 Wilco Dijkstra
2021-06-07 12:33 ` Amit Choudhary
2021-06-08  6:33 ` Amit Choudhary
2021-06-08  7:25   ` Amit Choudhary
2021-06-07 14:46 Wilco Dijkstra
2021-06-07 15:21 ` Amit Choudhary
2021-06-07 16:02   ` Amit Choudhary
2021-06-07 16:04   ` Wilco Dijkstra
2021-06-07 16:17 Wilco Dijkstra
2021-06-07 17:33 ` Florian Weimer
2021-06-08  4:52   ` Siddhesh Poyarekar
2021-06-09 10:31 Wilco Dijkstra
2021-06-09 11:42 ` Amit Choudhary
2021-06-09 12:05   ` Phil Blundell
2021-06-09 12:11     ` Adhemerval Zanella
2021-06-09 12:22       ` Amit Choudhary
2021-06-09 12:55         ` Adhemerval Zanella
2021-06-09 13:18           ` Amit Choudhary
2021-06-09 13:32             ` Amit Choudhary
2021-06-09 13:40             ` Adhemerval Zanella
2021-06-09 14:08               ` Amit Choudhary
2021-06-09 14:25                 ` Phil Blundell
2021-06-09 12:18     ` Amit Choudhary
2021-06-09 13:48       ` Phil Blundell
2021-06-09 21:44   ` Wilco Dijkstra
2021-06-10  2:42     ` Amit Choudhary
2021-06-10  3:23       ` Dan Raymond
2021-06-10  4:19         ` Amit Choudhary
2021-06-10  9:44       ` Wilco Dijkstra
2021-06-10 11:08         ` Amit Choudhary
2021-06-10 16:53           ` Amit Choudhary
2021-06-10 20:04             ` Amit Choudhary
2021-06-11  8:28               ` Amit Choudhary
2021-06-11 11:45           ` Wilco Dijkstra
2021-06-11 12:42             ` Amit Choudhary
2021-06-11 13:39               ` Amit Choudhary
2021-06-11 13:46               ` Wilco Dijkstra
2021-06-11 15:52                 ` Amit Choudhary
2021-06-11 19:14                   ` Amit Choudhary
2021-06-11 19:26                     ` Paul Eggert
2021-06-11 19:41                       ` Amit Choudhary
2021-06-11 20:00                         ` Dan Raymond
2021-06-12  4:00                           ` Amit Choudhary
2021-06-12  4:18                             ` Amit Choudhary
2021-06-11 13:57               ` Paul Zimmermann
2021-06-11 14:04                 ` Amit Choudhary
2021-06-11 14:16                   ` Paul Zimmermann
2021-06-11 14:27                     ` Amit Choudhary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR11MB15774A5725082B2A0473D2EF92369@DM5PR11MB1577.namprd11.prod.outlook.com \
    --to=wangyang.guo@intel.com \
    --cc=amitchoudhary0523@gmail.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).