English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
substring match like "strstr"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-12-14 (18:23)
From: Eijiro Sumii <sumii@v...>
Subject: Re: substring match like "strstr"
Julian Assange <proff@iq.org> wrote:
> All of these more sophisticated methods are only going to be a win
> when you are searching for larger strings. strstr is brutally simple,
> has little setup/cleanup time, and hence is hard to beat for short
> strings.

That is completely correct, and the substrings in my application are
indeed short (3 characters), but:

eijiro_sumii@anet.ne.jp wrote:
| Since my program calls the function more than 3000 times for _each_
| pattern, I did partial application, of course.  Even so, kmp in OCaml
| still performed much worse than strstr in libc (both Sun's and GNU's),
| at least in this program.

I expected that 3000 strings for 1 substring, each of which are about
20 characters long as I mentioned before, are enough for paying the
"setup/cleanup" overhead.  (On the other hand, strstr in libc doesn't
benefit from the partial application, of course.)