The wp_get_nav_menu_items() function retrieves complete menu data each time it is executed. To make the process more performance-efficient, we store the menu data in a transient (_transient_saswp_nav_menu..) so it can be reused without repeatedly fetching the same information.
Regarding your concern that the autoloaded plugin database option is more than 250 kB. We don’t consider this to be particularly large, as it is still within the kilobyte range and not unusually high for cached menu data.
Please let us know if you notice any specific performance impact, and we’ll be happy to investigate further.
Firstly, I made a typo – I would have written that it is more than 350 kB instead of 250. According to the docs, the total size/sum of autoloaded options shouldn’t be more than 800 kB. Your 350 kB takes up 45 % of the recommended total. I would defintely consider that as particularly large. Aditionally, the gap to the second biggest autoloaded options is huge as well meaning there is something off about the autoloaded transient here.
I have checked the content of the transient, and I see lots of stuff/properties that does not bring any value. What about stripping that out before saving the transient/option?
Empty/irrelevant might include post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_mime_type, comment_count, to_ping, post_content_filtered. Autoloading these things at every load looks a bit bloated.
Thank you very much for your detailed analysis. We truly appreciate the time you took to investigate this.
We can now clearly see that some unnecessary data is being stored in the _transient_saswp_nav_menu option, which is increasing the autoloaded data size.
We will take a deeper look into this and work on optimizing it in the upcoming updates.
Awesome! Looking forward to see an update for that in the futur 🙂 Hopefully, it will reduce TTFB with some miliseconds – and that’s always a nice improvement.
We have released a fix for this issue in the latest version 1.57. Kindly update the plugin, delete the existing transients, and allow the plugin to generate new transients for the menu. Then check whether the autoload size has been reduced.