I did a quick benchmark on a 1.8 GHz Pentium running 1'000'000 iterations for
matching/not-matching simple/complex wildcards. (Theo WH is the original
WildcardHelper where the compiled pattern is cached.)
assertNull(WildcardMatcherHelper.match("menu/*.xml", "menu/foo.html"));
New WMH: 281ms
Old WMH: 1472ms
Orig WH: 1833ms
Theo WH: 1192ms
assertNotNull(WildcardMatcherHelper.match("menu/*.xml", "menu/foo.xml"));
New WMH: 1622ms
Old WMH: 2103ms
Orig WH: 2423ms
Theo WH: 1824ms
assertNull(WildcardMatcherHelper.match("menu/**/*.xml", "menu/foo/bar.html"));
New WMH: 240ms
Old WMH: 2574ms
Orig WH: 2704ms
Theo WH: 1954ms
assertNull(WildcardMatcherHelper.match("menu/**/*.xml", "menu/bar.xml"));
New WMH: 2413ms
Old WMH: 1633ms
Orig WH: 1983ms
Theo WH: 1312ms
assertNotNull(WildcardMatcherHelper.match("menu/**/*.xml", "menu/foo/bar.xml"));
New WMH: 7271ms
Old WMH: 3155ms
Orig WH: 3454ms
Theo WH: 2744ms
Bottomline is that the new implementation is between 10 times faster and 3 time
slower than previous implementations. In a typical mix of patterns and input
strings all should perform within a very narrow range.
The absolute number of a few *microseconds* per iteration makes anyway any
difference peanuts compared to the complete request handling taking tens of
milliseconds.
Cheers, Alfred.
-----Original Message-----
From: Joerg Heinicke [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 21. September 2006 19:53
To: [email protected]
Subject: Re: Wildcard matcher matching wild things
On 20.09.2006 10:39, Nathaniel Alfred wrote:
> Since map:match is the
> most frequently executed pipeline instruction, speed is an issue. That
> can be mastered by a) caching the compiled regexps and b) handling the
> simple pattern with a single * or ** as special cases without using
> regexps.
Just wondering, did you actually do some performance comparisons?
Regards,
Jörg
This message is for the named person's use only. It may contain confidential,
proprietary or legally privileged information. No confidentiality or privilege
is waived or lost by any mistransmission. If you receive this message in error,
please notify the sender urgently and then immediately delete the message and
any copies of it from your system. Please also immediately destroy any
hardcopies of the message. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the intended
recipient. The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this message are
those of the individual sender, except where the message states otherwise and
the sender is authorised to state them to be the views of the sender's company.