Forums › Forums › Search & Filter Pro › Request for performance improvement
Tagged: V3
- This topic has 7 replies, 3 voices, and was last updated 4 years, 5 months ago by Ross.
-
Ross Moderator(Private) June 29, 2020 at 9:54 am #250370
Hi Ash
S&F shouldn’t be doing that many queries, especially not on pages it’s not used
Can you provide a link / access to take a look at what’s going on?
Thanks
Trevor(Private) June 29, 2020 at 9:59 am #250372I believe that we are working on performance improvements for V3 of our plugin (due in a few months), but I have referred your query to the plugin developer, Ross, for any additional input he might wish to add.
One trade off is whether you choose on your finished site to load all CSS and JS assets as separate files, and thus be able to dequeue the unnecessary ones (in relation to each page), knowing that any individual page might be very slightly faster to load, but also knowing that if a user visits many pages, that may actually give an overall slower performance, compared to …
If all files load on all pages, a CSS and JS combining cache plugin would have only two minified files to load, which can be served from the browser cache. Serving it this way may actually less data overall, and actually be faster.
Anonymous(Private) June 29, 2020 at 10:04 am #250374I used get_num_queries() to benchmark db query.
You can see the result at the bottom of the page.
https://wordpress-81370-1352312.cloudwaysapps.com/Without S&F: 18 queries
With S&F: 25 queriesAlso these are being loaded.
css: search-filter.min.css
js: search-filter-build.min.jsRoss Moderator(Private) June 29, 2020 at 10:19 am #250380Hi Ash
Can I get admin access, and can we install query monitor plugin?
https://wordpress.org/plugins/query-monitor/Regarding the CSS + JS, as CSS can only be included in the head, we must include it on evey page (because the shortcode can be included anywhere, sidebar, page content, custom template there is no way to reliable detect before the page had loaded, if S&F is present). You can exclude wp_dequeue_style to remove it from the page you don’t want
Something similar happens for JS, although we could conditionally load the JS based on whether a search form is present (and load in the footer), we also need to check if there are any search results on the page – which we do not.
If you want, in the Search & Filter admin settings page, there is an option where you can disable loading of CSS + JS, and add them to your theme however you want.
Just to add, as per Trevors comment, we are looking at improving this in v3.
Thanks
Ross Moderator(Private) June 30, 2020 at 10:37 am #250611Hi Ash
Ok so I found out it’s not so alarming, but it looks like the queries that are being called are necessary.
If you take a look here (logged in):
https://wordpress-81370-1352312.cloudwaysapps.com/Then open query monitor from the admin bar, you can then find “queries by component” and select S&F Pro:
There you will see, there are 7 queries run, however, 5 of them are
get_option
. Many plugins need to call this to check if they need to run things on the page, and any performance hit should be pretty much nullified if your server is using object caching.There is a case to be made though, to lump all our settings in to 1 option… but that does not seem standard practise across from what I’ve seen – I will look at streamlining this anyway, for version 3.
In regards to the 2 other queries, they just loop through our S&F post type, to see if there are any settings that need action – such as setting up a search results, or not – however, there should in fact only be 1 needed to get the list of search forms we need…
So all in all, there is 1 query which shouldn’t be there ( I will look in to optimizing ) and the others are expected – it may be possible to improve this also.
I will take all this into consideration now while building v3.
For now, those queries are incredibly small, and with some caching in place even on large sites you shouldn’t really a see a performance hit – although you are entirely correct in that there is room for improvement.
Let me know your thoughts.
Best
-
AuthorPosts