Proposal for exact matching and matching at a position in RegExp

Andy Chu andy at
Tue Feb 9 09:56:13 PST 2010

On Tue, Feb 9, 2010 at 7:34 AM, Kam Kasravi <kamkasravi at> wrote:
> Hi Andy
> I had mentioned to Brendan at the last TC39 that you had ported narcissus
> and had observed the cost of match.
> There is a new global regexp parameter called 'y' which prevents the copy
> from occurring.
> I've taken a look at narcissus and made some edits adding y to match. Both
> Brendan and Bob Clary
> have advised on how to get the changes into mercurial on mozilla if you are
> not a developer within mozilla.
> I can forward you these emails and we could review respective changes if you
> would like and its ok with
> mozilla. The mozilla bug id
> is

Thanks for mentioning that.  Is Narcissus being used for something
now?  I had to make a ton of changes to get it to work on non-Mozilla
engines (v8, JScript).  It got stuck on this performance issue due to
lack of /y.  But adding this would introduce another nonstandard

I think the solution depends on if the mainline wants to be standard
ECMAScript or not.  For non-Mozilla engines, the solution without /y
is a bit of a pain.  What I would do is change the tokenizer to work
line-by-line rather on the code entire string.  You will still have
quadratic behavior within a line, but if lines are less than 100
characters, it won't blow up with a large program size.  This would
solve it for Mozilla too of course, so I might just go with that since
I want it to be standard ECMAScript.


More information about the es-discuss mailing list