[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2000-12-11 (17:38) |
From: | Gerd Stolpmann <gerd@g...> |
Subject: | Re: substring match like "strstr" |
On Sun, 10 Dec 2000, eijiro_sumii@anet.ne.jp wrote: >OK, I benchmarked the following 4 implementations for the purpose of >comparison. > > strstr > stub to call "strstr" in libc > > regexp > combination of "Str.regexp_string" and "Str.search_forward" > > OCamlA > the simple implementation in OCaml given in the previous message, > a little tuned for more efficiency > > OCamlB > another straightforward implementation in OCaml, attached at the > end of this message > >The results (execution time in seconds) were as follows. > > strstr 55.74 > regexp 154.37 > OCamlA 302.57 > OCamlB 129.23 I did not expect that OCamlB performs so well; so I suggested OcamlA and regexp (which are both fast for the bytecode interpreter, too). I think it depends also on the problem size (especially on the length of the substring). Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 100 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ----------------------------------------------------------------------------