Walt Mankowski on 21 Oct 2009 20:20:37 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] PCRE is_a_regex?

On Wed, Oct 21, 2009 at 03:50:01PM -0400, JP Vossen wrote:
> I have 300K+ valid regular expressions.  I am abstracting out one more 
> level on about 100K of them, and instead of being matched as regexps, 
> they will be matched as static strings in a hash table (in Java). 

Are you doing that because the hash table lookup is faster?  It's not
obvious to me that it should be.  Doing a regex comparison on a plain
string should be pretty close to just checking if the two strings are
equal, and that's going to be O(n).  A hash lookup also has to be O(n)
since you've got to read the string to hash it.


Attachment: signature.asc
Description: Digital signature

Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug