Commit 39dae7f
committed
Deprecated: optimize regular expression for $.trim for long sequences of whitespace runs
Regex imp implementation takes O(N^2) time to trim the string when multiple
adjacent spaces were present.
The new expression require that the "whitespace run" starts from a non-whitespace
to avoid O(N^2) behavior when the engine would try matching "\s$" at each space position.1 parent 410d5cf commit 39dae7f
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
85 | | - | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
0 commit comments