Needs work
Project:
Drupal core
Version:
main
Component:
filter.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Aug 2013 at 19:15 UTC
Updated:
16 Sep 2026 at 17:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
catchI didn't have as good an example, but this reduced 3.5ms down to 2.6ms on a relatively short page (204 calls to preg_replace() changed to strcasecmp()).
This should be a good improvement on sites with lots of content (hence a high filter cache miss), or sites which have filters that disable the filter cache altogether.
Comment #2
catchComment #3
j0rd commentedDoesn't look like the preg_match needs to be there, unless the chunks have additional characters on the left or right, in which case preg_match() would return 1 and strcasecmp() would return 0.
If that's not the case, and it's faster then looks like a good patch to me.
Comment #4
zero2one commentedChanged the status to needs review so the testbot picks it up.
Comment #6
douggreen commentedDoh! While reviewing patches applied to a client site, I discovered that this had a very stupid problem, $i instead of 1! And 2 years later :( Let's see if this passes tests.
Comment #7
douggreen commentedThe same patch applies to D7 and D8 :)
Comment #8
douggreen commentedWell, it almost applies ... here's the D7 backport
Comment #9
douggreen commentedIt's nice that it applies here, but I'm using these patches with composer and https://github.com/cweagans/composer-patches, so here's another minor fix.
Comment #24
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #25
smustgrave commentedWanted to bump 1 more time, could we get an profiling to prove this?
Comment #27
smustgrave commentedFunction has been turned to OOP service but still uses preg_match()