• Resolved peter8nss

    (@peter8nss)


    I’m tuning my page loads and noticed a number of individual calls of get option on each page each causing a database read – rather than these being loaded in one go by wp_load_alloptions. I think these are all options that have never been saved to the database.

    fs_storage_logger
    fs_clone_management
    fs_cache_235
    dynamic-mobmenu

    Is it possible for you to modify your plugin to make sure a value is held in the database for each of these options to improve the page load performance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Rui Guerreiro

    (@takanakui)

    Hi @peter8nss,

    Sorry for the delay, I noticed I haven’t replied.

    The get_option function has a cache mechanism so it is only one database read that would be the same of loading all options.

    Loading all options can you cause more database reads and an initial slowndow, you can end up loading options that wouldn’t be used during the visitor navigation.

    On those four functions only the dynamic-mobmenu that loads the dynamic CSS is controlled by us. The other three are from a framework that we use and that is present in hundreds of plugins and millions of installs.

    Hope that explains why it is implemented like it is.

    Thread Starter peter8nss

    (@peter8nss)

    Whilst you are correct:

    • get_option is cached – so only called once per page for each option not autoloaded
    • including unused options in autoload is undesirable – because it increases resources used by wp_load_alloptions

    The options mentioned are “used”, otherwise they wouldn’t appear in every page load. So instead of one database read (for wp_load_alloptions) there are five database reads (wp_load_all_options + 1 each for the other options). And that is for every page load.

    I appreciate that some of these may be linked to a framework you use rather than your own code. Perhaps you could pass the message on to them and help improve multiple plugins in the process.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.