Improve performance of events processing #27
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WeekView
, to only sort them onceeventsByDate
object is created, with date as keys (in format "YYYY-MM-DD") and list of events as valuesEvents
component accesses the events from the same object, avoiding extra copies and sorting more than necessaryWeekView.render
, to avoid re-calculations when not necessaryEvents
andHeader
PureComponents
, to avoid extra re-rendersTimes
component to display time column (is aPureComponent
to avoid extra re-renders)WeekView.scrollEnded
only update the state if the date actually changes, to avoid an extra re-renderApp.js
to state, to ease testing processcalculateDaysArray()
functionPS: in my use case, I have about 1500 events, and it was taking 3-5 seconds to load 😬
PS2: I realize these may be a lot of logic changes and you may not agree with them, but I needed to make these improvements for my use case ASAP, so I just applied them without discussing them first. I understand if you want to further improve them, or reject them at all 🙂