Calendar - poor performance

Support for the WordPress Calendar plugin
Dave P
Posts: 2
Joined: Fri Dec 14, 2012 4:47 pm

Calendar - poor performance

Unread post by Dave P » Mon Oct 03, 2016 11:32 pm

I have been looking at the performance of my website using cachegrind on my computer to analyse what is happening on individual web pages. This analysis has highlighted a few issues:

1) When using the "Upcoming Events", grab_events is called against each possible day. As I am looking out the next 2 months, this is making 60+ calls against the calendar table on columns that are not indexed. Why can the function grab_events not accept a range of dates and then generate the list of "daily" events for the period? I recognise this would change some of the logic within the functions that use this function. The second issue with grab_events is the SQL query is over complex in that each call runs a SQL query which is a union of 7 subsequeries with the results processed within the PHP code; surely it would be quicker to just get the "normal" events, and do the processing of the "repeating" events within PHP extending the work already done on these events. [i.e. my 60+ queries have become 400+ database queries]

2) Looking at elsewhere at the code, I can see you are basically using "grab_events" to determine whether there is an event on a specific day, again processing the list of events over a period once will speed up these routines.

3) There are a number of routines called multiple times with the same calculations being performed each time, If the calendar plugin was encapsulated as a class, this would enable the results to be cached as local variables within the plugin to improve performance.

4) I notice elsewhere you have mentioned in response to concerns on performance that you have imposed limits on the numbers of days the plugin would look out, addressing point (1) above would provide a solution to these concerns.

Thoughts and comments on these issues would be welcome as I really like the plugin's functionality and ease of use, but the performance is really causing me problems.

User avatar
Kieran
Posts: 2058
Joined: Sat May 26, 2007 1:55 pm
Location: London
Contact:

Re: Calendar - poor performance

Unread post by Kieran » Sun Feb 18, 2018 8:39 pm

Response to this here: https://wordpress.org/support/topic/poor-performance-3/

I'm working on this right now after a bit of a hiatus :)

Post Reply