Opened 16 years ago
Closed 16 years ago
#7363 closed enhancement (fixed)
Optimization for kses
Reported by: | azaozz | Owned by: | |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | 2.6 |
Component: | Optimization | Keywords: | |
Focuses: | Cc: |
Description
Each time create_function() is called, it makes new global function taking up a bit of memory. It shouldn't be used where it may be called many times, like in loops or in functions that may be run many times.
It doesn't seem to be needed in preg_replace_callback() when there's already a callback function defined for it.
Attachments (2)
Change History (8)
#2
follow-up:
↓ 3
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Did we really need to change the argument list for a load of functions that plugin authors might have been using?
Could we not store the anonymous functions in function level static variables or just make them un-anonymous while still preserving the old functions for plugin authors and getting the performance benifit?
#3
in reply to:
↑ 2
@
16 years ago
Replying to westi:
Did we really need to change the argument list for a load of functions that plugin authors might have been using?
The wp_kses_normalize_entities3() is new, just added few hours ago. The other two seems to have been made as callback functions for the specific preg_replace_callback(). Tried searching the Net for any place they've been used directly, but nothing came back.
However you're right that they may be used directly too, although they're a bit too specific/limited as callbacks.
@
16 years ago
Reverts most of the previous changes and adds helper functions used as callbacks instead of create_function()
(In [8387]) kses - don't use create_function in preg_replace_callback. Fixes #7363.