问题
I am rendering 100 events in FullCalendar using $('#CalendarPlugin').fullCalendar('renderEvent', {} );
being called 100 times in a loop.
The browser performance I'm seeing on my computer (Core2 6600 @ 2.4GHz with 4GB RAM)
- Chrome: 3 seconds
- Firefox: 6 seconds
- IE9: 6 seconds
Is this an expected level of performance? Is there a faster way to load and render events?
Once they've been added to FullCalendar, moving between months and re-rendering it much faster. It's just the initial loading of them using renderEvent
that's slow.
回答1:
The developer was working on performance enhancements for the 1.4.4 version, but hitting the plugin 100 times in a loop is still hefty.
One technique you could try to improve performance is to use an object in addEventSource
as this waits and renders altogether I believe:
$("#calendar").fullCalendar("addEventSource", msg.items);
回答2:
The idea is to fetch all events in a certain period at once, look at the api
http://arshaw.com/fullcalendar/docs/event_data/events_array/
http://arshaw.com/fullcalendar/docs/event_data/events_json_feed/
http://arshaw.com/fullcalendar/docs/event_data/events_function/
Your performance increases once they are loaded initially because by default events are cached.
来源:https://stackoverflow.com/questions/5950358/fullcalendar-what-level-of-events-rendering-performance-should-i-expect