Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Searching large lists
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-11-08 (15:25)
From: Jerome Vouillon <jerome.vouillon@i...>
Subject: Re: [Caml-list] Searching large lists
On Thu, Nov 08, 2001 at 06:06:57AM -0800, Andrew Lawson wrote:
>      I have a list containing up to 100,000 strings
> between 10 and 200 characters in length. I want to
> produce a list of those that match a regular
> expression. It seems that the obvious way is to
> List.filter with a predicate returning true if the
> string matches, however in my case this can take up to
> 15 seconds. Has anyone got any ideas for speeding this
> up?

The Str library is really slow.

For Unison (, we wrote our
own regular expression library to get acceptable performances.

You should try PCRE ( or maybe RE

If you compile to native code, the RE library should be the fastest in
your case (probably about 5 to 10 times faster than PCRE).  It is
still under development though, so some features are missing.

-- Jerome
Bug reports:  FAQ:
To unsubscribe, mail  Archives: