caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mark Wotton <mrak@cs.usyd.edu.au>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Searching large lists
Date: Fri, 9 Nov 2001 01:14:36 +1100 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.21.0111090111520.9753-100000@hons.cs.usyd.edu.au> (raw)
In-Reply-To: <20011108140657.75752.qmail@web12305.mail.yahoo.com>

On Thu, 8 Nov 2001, Andrew Lawson wrote:

> Hi all
>      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?
> 
>      thanks
> 
>            Andrew

This would probably require rewriting whatever you're using to do the
regexes, but if you use a trie to store all the strings, you could
maintain a list of nodes which matched at each stage of the regex. This
should be a fair bit faster...

mrak


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-11-08 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-08 14:06 Andrew Lawson
2001-11-08 14:14 ` Mark Wotton [this message]
2001-11-08 15:24 ` Jerome Vouillon

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=Pine.LNX.4.21.0111090111520.9753-100000@hons.cs.usyd.edu.au \
    --to=mrak@cs.usyd.edu.au \
    --cc=caml-list@inria.fr \
    /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 NNTP newsgroup(s).