[wp-trac] [WordPress Trac] #58277: Change the position of notoptions lookup in get_option
WordPress Trac
noreply at wordpress.org
Tue May 9 13:08:33 UTC 2023
#58277: Change the position of notoptions lookup in get_option
--------------------------------+-----------------------------
Reporter: spacedmonkey | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version:
Severity: normal | Keywords:
Focuses: performance |
--------------------------------+-----------------------------
Added in [4855] and #3726 the `notoptions` cache was added to
`get_option`. This cache was designed to save database queries, do option
name that are none not to exist in the database / cache.
However, the ordering this functions present a performance problem. In
`get_option` the look for if a option does not exist, is done before if it
does. It is extremely uncommon for a get_option, for a option name that
does not exist. Most times it is called, it for a option that does exist.
This means the call to `notoptions` cache is called pointless.
Moving this check, before the database lookup would improve performance.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58277>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list