My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2344: addEventSource slow with large number of array sources
1 person starred this issue and may be notified of changes. Back to list
Status:  ExportedToGithub
Owner:  ----
Closed:  Aug 2015


Sign in to add a comment
 
Reported by colin.ch...@gmail.com, Nov 5, 2014
My company is having some issues with some clients with very large calendars. For a small date range, they can have upward of 150 or more event sources, with 5 or more events each. As shown in the stress test (https://github.com/arshaw/fullcalendar/blob/master/tests/event_stress_test.html), adding a large number of events is handled very well and quickly. However, when you try to add the same number of events but with a large number of event sources, it takes almost a whole minute. Please see my jsfiddle for an example (http://jsfiddle.net/jonLtbzc/1/). This is clearly unusable for someone trying to click through months and having to wait a minute for each month to load. I believe this is due to the fact that the calendar calls reportEvents() after each source added. If all sources are added at once, then rendered only once, the calendar loads significantly faster. I have been able to see significant speedups with minor modifications to addEventSource() or by creating a new addEventSources() method. Here is my implementation for that method. Please keep in mind that this was created very quickly with very little understanding of the code so it will probably require some modification.


function addEventSources(sourceInput) {
    if(sourceInput) {
        pendingSourceCnt = sourceInput.length;
        for(var i = 0; i < sourceInput.length; i++) {
            var source = buildEventSource(sourceInput[i]);
            if (source) {
                sources.push(source);
                fetchEventSource(source, currentFetchID);
            } else {
                pendingSourceCnt--;
            }
        }
    }
}
Nov 15, 2014
Project Member #1 adamrs...@gmail.com
v2.2 might be a little better, as event rendering in general has been sped up, but this problem will still exist. I believe the solution, as you said, it to batch the event rendering together.

You must be using Array event sources, right? If you were using AJAX or some other asynchronous event source method, this problem would not happen.

Note to self: the solution to this is probably to force array event sources to be asynchronous, via setTimeout
Summary: addEventSource slow with large number of array sources (was: addEventSource slow with large number of sources)
Status: Accepted
Labels: Type-Bug
Nov 17, 2014
#2 colin.ch...@gmail.com
Yes, each of the sources I am trying to add are arrays. In addition to the method I shared above, when I first ran into this issue I did also try what you noted about setTimeout and it appears to work great. I simply wrapped the fetchEventSource call within the addEventSource function with a setTimeout and it sped things way up. Not being familiar with your code, I was just unaware of any side effects this may cause.
Jun 7, 2015
#3 Loren...@gmail.com
hi there, I am also experiencing the same performqnce problem with multiple event sources using arrays, was this ever addressed in the latest updates?

Aug 21, 2015
Project Member #4 adamrs...@gmail.com
Discussion for this issue has moved to the following URL:
https://github.com/fullcalendar/fullcalendar/issues/2609

This is because Google Code is shutting down. Apologies if you are being pestered with these notifications. This is a one-time event.

Happy coding,
Adam
Status: ExportedToGithub
Sign in to add a comment

Powered by Google Project Hosting