Opened 13 years ago
Closed 13 years ago
#15093 closed enhancement (fixed)
wptexturize() efficiency improvement: remove unnecessary repetition operators
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch |
Focuses: | Cc: |
Description
There are few regular expressions in wptexturize() that are used to match strings of the form /(\d+){suffix}/
or /{prefix}(\d+)/
for replacement with {something else}$1
or $1{something else
}, respectively.
The repetition operator is not needed; matching only the last (or first) digit in the series of digits is equivalent. Since the repetition operator will cause more backtracing when processing the regular expression, removing it will increase efficiency.
In my (very naive) tests, I found about a 2% speed increase when removing those repetition operators.
Patch attached.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
(In [15816]) Improve regex performance in wptexturize(). Props mdawaffe. fixes #15093