-
Notifications
You must be signed in to change notification settings - Fork 12
Reduce indirections and calls with side-effects to make it easier to achieve a reasonable baseline performance? #32
Comments
Hmm - directly testing for
I could certainly pass the string into
I explicitly and intentionally have prohibited that fast path, since the intention is to 100% hide observable |
Ah, another reason I'm using |
Filed #33 to reduce observability when a string is passed. |
I would have expected the following specifications for
String.prototype.matchAll
andRegExp.prototype [ @@matchAll ]
:String.prototype.matchAll ( regexp )
RegExp.prototype [ @@matchall ] ( string )
String.prototype.matchAll:
@@matchAll
avoids the extraIsRegExp
call which can produce side-effects. And it also matches the calling pattern in all otherString.prototype
methods which take a RegExp argument.RegExpCreate
to create a new RegExp object and then callingMatchAllIterator
to create just another new RegExp seems wasteful and makes it harder to optimize this function for implementors.RegExp.prototype [ @@matchall ]:
IsRegExp
call makes it easier to optimize this case, because we don't have to worry about potential side-effects.flags
argument allows us to take the fast path in 21.2.3.1, step 4 (https://tc39.github.io/ecma262/#sec-regexp-pattern-flags).The text was updated successfully, but these errors were encountered: