chakra-core / chakra-core/ChakraCore

RegExp: String replace operations using Regular Expressions are slow in EDGE and IE9+ for large strings

Open
#1,733 4 comments 0 reactions 0 assignees View on GitHub
Performance Severity: 3
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

RegEx evaluator in Chakra Core seems to perform slowly (takes more than double the time) for large strings compared to Chrome.

Standalone test case to reproduce the issue
http://jsfiddle.net/Lwa0t5rp/3/

Sample test output extract
Chrome: v53.0.2785
regex 1: 2.8100000000000214 regex 2: 1.3566666666666833 ( rows : 4096 string length:2569724)
regex 1: 3.7816666666666756 regex 2: 2.7783333333333453 ( rows : 8192 string length:5146108)
regex 1: 7.228333333333315 regex 2: 6.0666666666666815 ( rows : 16384 string length:10337180)
regex 1: 14.333333333333334 regex 2: 11.303333333333436 ( rows : 32768 string length:20741020)
regex 1: 27.843333333333362 regex 2: 29.471666666666692 ( rows : 65536 string length:41548700)

EDGE: v38.14393.0.0 EdgeHTML 14.14393
regex 1: 5.059881559322018 regex 2: 2.975162459528974 ( rows : 4096 string length:2205180)
regex 1: 9.785139583279791 regex 2: 6.15836259479958 ( rows : 8192 string length:4417020)
regex 1: 19.578437506784894 regex 2: 11.69511229889531 ( rows : 16384 string length:8879004)
regex 1: 44.75823350880349 regex 2: 25.138609542494805 ( rows : 32768 string length:17824668)
regex 1: 78.02833970539177 regex 2: 47.913274211683984 ( rows : 65536 string length:35715996)

IE11 performance is far worse
IE11: v11.187.14393.0
regex 1: 17886.814111784788 regex 2: 5.659022724537256 ( rows : 4096 string length:2205180)

Contributor guide

Open the contributing guide

Research direction

Start with the standalone reproduction at http://jsfiddle.net/Lwa0t5rp/3/ and measure the two large-string regular-expression replacements in the reported Edge and IE versions. Trace the Chakra Core regular-expression evaluator involved in String.replace, then compare timings against the supplied output. Done means the reported large-string operations no longer show the documented severe slowdown.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.