[wp-trac] [WordPress Trac] #15093: wptexturize() efficiency improvement: remove unnecessary repetition operators
WordPress Trac
wp-trac at lists.automattic.com
Mon Oct 11 03:22:33 UTC 2010
#15093: wptexturize() efficiency improvement: remove unnecessary repetition
operators
-------------------------+--------------------------------------------------
Reporter: mdawaffe | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15093>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list