Skip to content

Conversation

@UberJason
Copy link
Contributor

Hi @MatthewYork! I recently discovered a performance problem when performing a lot of date calculations in a row, which boils down to the fact that initializing Calendar.autoupdatingCurrent is a somewhat expensive operation. This PR simplifies things by simply keeping a static copy of Calendar.autoupdatingCurrent on Date and using it everywhere. I had an operation that was taking 8 seconds drop to <1 second with this fix.

Jason Ji and others added 4 commits March 29, 2017 11:52
…, avoiding constantly reinstantiating it (which is a performance hit when performing multiple consecutive Date manipulations)
…d reading an incorrect number of hours apart.
@UberJason
Copy link
Contributor Author

Hi @MatthewYork, thought I should call attention to this again. It's a pretty simple but performance-increasing fix. I accidentally included these commits in my PR #256 (now closed) for a different issue.

… but the day component is 2 apart. (Example: April 19, 10PM and April 21, 2PM)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant