{"action":"created","comment":{"url":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/comments/240420560","pull_request_review_id":183448190,"id":240420560,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDQyMDU2MA==","diff_hunk":"@@ -55,17 +55,14 @@ export function eventLevels(rowSegments, limit = Infinity) {\n   return { levels, extra }\n }\n \n-export function inRange(e, start, end, accessors) {\n-  let eStart = dates.startOf(accessors.start(e), 'day')\n-  let eEnd = accessors.end(e)\n+export function inRange(e, lowerBound, upperBound, accessors) {","path":"src/utils/eventLevels.js","position":23,"original_position":7,"commit_id":"1aac0619787da5c2c591909648112ce3b2c91f48","original_commit_id":"124a780ddf7d3ed5c4a3809cc1800c6a0c27f354","user":{"login":"bs85","id":3041431,"node_id":"MDQ6VXNlcjMwNDE0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3041431?v=4","gravatar_id":"","url":"https://api.github.com/users/bs85","html_url":"https://github.com/bs85","followers_url":"https://api.github.com/users/bs85/followers","following_url":"https://api.github.com/users/bs85/following{/other_user}","gists_url":"https://api.github.com/users/bs85/gists{/gist_id}","starred_url":"https://api.github.com/users/bs85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bs85/subscriptions","organizations_url":"https://api.github.com/users/bs85/orgs","repos_url":"https://api.github.com/users/bs85/repos","events_url":"https://api.github.com/users/bs85/events{/privacy}","received_events_url":"https://api.github.com/users/bs85/received_events","type":"User","site_admin":false},"body":"Commented the inRange method","created_at":"2018-12-10T23:22:54Z","updated_at":"2018-12-10T23:22:54Z","html_url":"https://github.com/intljusticemission/react-big-calendar/pull/1123#discussion_r240420560","pull_request_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/comments/240420560"},"html":{"href":"https://github.com/intljusticemission/react-big-calendar/pull/1123#discussion_r240420560"},"pull_request":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123"}},"in_reply_to_id":235441814},"pull_request":{"url":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123","id":232704965,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyNzA0OTY1","html_url":"https://github.com/intljusticemission/react-big-calendar/pull/1123","diff_url":"https://github.com/intljusticemission/react-big-calendar/pull/1123.diff","patch_url":"https://github.com/intljusticemission/react-big-calendar/pull/1123.patch","issue_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/issues/1123","number":1123,"state":"open","locked":false,"title":"improve date manipulation performance","user":{"login":"bs85","id":3041431,"node_id":"MDQ6VXNlcjMwNDE0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3041431?v=4","gravatar_id":"","url":"https://api.github.com/users/bs85","html_url":"https://github.com/bs85","followers_url":"https://api.github.com/users/bs85/followers","following_url":"https://api.github.com/users/bs85/following{/other_user}","gists_url":"https://api.github.com/users/bs85/gists{/gist_id}","starred_url":"https://api.github.com/users/bs85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bs85/subscriptions","organizations_url":"https://api.github.com/users/bs85/orgs","repos_url":"https://api.github.com/users/bs85/repos","events_url":"https://api.github.com/users/bs85/events{/privacy}","received_events_url":"https://api.github.com/users/bs85/received_events","type":"User","site_admin":false},"body":"After debugging performance issues with a very heavily loaded calendar (~300 events per day across ~15 resources, 3 months of events passed in the `events` variable), I realized a couple functions were responsible for over 90% of the processing time.\r\n\r\nThis version is an order of magnitude faster for my use-case, going from ~900ms to < 70ms to render a heavily loaded week-view.\r\n\r\nThe main culprit I found was `date-arithmetic`, especially the `startOf` function, that while written very elegantly has absolutely horrible performance as it mutates the date many times.\r\n\r\nWhile debugging it, I also realized `eventLevels.inRange` implementation was very costly, and could be sped up 10-20x by changing the input params a bit (passing the real range we want to filter and just using `<` and `>`).\r\n\r\nI also added a autoDetectAllDayEvents prop to the calendar, that is true by default. Changing it to false will stop analysing every event time to see if both start and end are 00:00:00.\r\n\r\nThis works theoretically and I've tested it with my dataset, but there might be corner cases I'm not thinking of (zero time events combined with something else, daylight savivng, etc?).\r\n\r\nThanks in advance for having an in-depth look!","created_at":"2018-11-21T15:29:17Z","updated_at":"2018-12-10T23:22:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0bb2c27f0570c4007f3492e9099ba5f2a25d879","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123/commits","review_comments_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123/comments","review_comment_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/issues/1123/comments","statuses_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/statuses/1aac0619787da5c2c591909648112ce3b2c91f48","head":{"label":"bs85:master","ref":"master","sha":"1aac0619787da5c2c591909648112ce3b2c91f48","user":{"login":"bs85","id":3041431,"node_id":"MDQ6VXNlcjMwNDE0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3041431?v=4","gravatar_id":"","url":"https://api.github.com/users/bs85","html_url":"https://github.com/bs85","followers_url":"https://api.github.com/users/bs85/followers","following_url":"https://api.github.com/users/bs85/following{/other_user}","gists_url":"https://api.github.com/users/bs85/gists{/gist_id}","starred_url":"https://api.github.com/users/bs85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bs85/subscriptions","organizations_url":"https://api.github.com/users/bs85/orgs","repos_url":"https://api.github.com/users/bs85/repos","events_url":"https://api.github.com/users/bs85/events{/privacy}","received_events_url":"https://api.github.com/users/bs85/received_events","type":"User","site_admin":false},"repo":{"id":157843176,"node_id":"MDEwOlJlcG9zaXRvcnkxNTc4NDMxNzY=","name":"react-big-calendar","full_name":"bs85/react-big-calendar","private":false,"owner":{"login":"bs85","id":3041431,"node_id":"MDQ6VXNlcjMwNDE0MzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3041431?v=4","gravatar_id":"","url":"https://api.github.com/users/bs85","html_url":"https://github.com/bs85","followers_url":"https://api.github.com/users/bs85/followers","following_url":"https://api.github.com/users/bs85/following{/other_user}","gists_url":"https://api.github.com/users/bs85/gists{/gist_id}","starred_url":"https://api.github.com/users/bs85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bs85/subscriptions","organizations_url":"https://api.github.com/users/bs85/orgs","repos_url":"https://api.github.com/users/bs85/repos","events_url":"https://api.github.com/users/bs85/events{/privacy}","received_events_url":"https://api.github.com/users/bs85/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bs85/react-big-calendar","description":"gcal/outlook like calendar component","fork":true,"url":"https://api.github.com/repos/bs85/react-big-calendar","forks_url":"https://api.github.com/repos/bs85/react-big-calendar/forks","keys_url":"https://api.github.com/repos/bs85/react-big-calendar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bs85/react-big-calendar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bs85/react-big-calendar/teams","hooks_url":"https://api.github.com/repos/bs85/react-big-calendar/hooks","issue_events_url":"https://api.github.com/repos/bs85/react-big-calendar/issues/events{/number}","events_url":"https://api.github.com/repos/bs85/react-big-calendar/events","assignees_url":"https://api.github.com/repos/bs85/react-big-calendar/assignees{/user}","branches_url":"https://api.github.com/repos/bs85/react-big-calendar/branches{/branch}","tags_url":"https://api.github.com/repos/bs85/react-big-calendar/tags","blobs_url":"https://api.github.com/repos/bs85/react-big-calendar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bs85/react-big-calendar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bs85/react-big-calendar/git/refs{/sha}","trees_url":"https://api.github.com/repos/bs85/react-big-calendar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bs85/react-big-calendar/statuses/{sha}","languages_url":"https://api.github.com/repos/bs85/react-big-calendar/languages","stargazers_url":"https://api.github.com/repos/bs85/react-big-calendar/stargazers","contributors_url":"https://api.github.com/repos/bs85/react-big-calendar/contributors","subscribers_url":"https://api.github.com/repos/bs85/react-big-calendar/subscribers","subscription_url":"https://api.github.com/repos/bs85/react-big-calendar/subscription","commits_url":"https://api.github.com/repos/bs85/react-big-calendar/commits{/sha}","git_commits_url":"https://api.github.com/repos/bs85/react-big-calendar/git/commits{/sha}","comments_url":"https://api.github.com/repos/bs85/react-big-calendar/comments{/number}","issue_comment_url":"https://api.github.com/repos/bs85/react-big-calendar/issues/comments{/number}","contents_url":"https://api.github.com/repos/bs85/react-big-calendar/contents/{+path}","compare_url":"https://api.github.com/repos/bs85/react-big-calendar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bs85/react-big-calendar/merges","archive_url":"https://api.github.com/repos/bs85/react-big-calendar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bs85/react-big-calendar/downloads","issues_url":"https://api.github.com/repos/bs85/react-big-calendar/issues{/number}","pulls_url":"https://api.github.com/repos/bs85/react-big-calendar/pulls{/number}","milestones_url":"https://api.github.com/repos/bs85/react-big-calendar/milestones{/number}","notifications_url":"https://api.github.com/repos/bs85/react-big-calendar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bs85/react-big-calendar/labels{/name}","releases_url":"https://api.github.com/repos/bs85/react-big-calendar/releases{/id}","deployments_url":"https://api.github.com/repos/bs85/react-big-calendar/deployments","created_at":"2018-11-16T09:21:17Z","updated_at":"2018-12-10T23:18:37Z","pushed_at":"2018-12-10T23:18:33Z","git_url":"git://github.com/bs85/react-big-calendar.git","ssh_url":"git@github.com:bs85/react-big-calendar.git","clone_url":"https://github.com/bs85/react-big-calendar.git","svn_url":"https://github.com/bs85/react-big-calendar","homepage":"http://intljusticemission.github.io/react-big-calendar/examples/index.html","size":7883,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"intljusticemission:master","ref":"master","sha":"91c6ec0adb7f2840e9439de1cf4690ef832f078e","user":{"login":"intljusticemission","id":5813881,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU4MTM4ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/5813881?v=4","gravatar_id":"","url":"https://api.github.com/users/intljusticemission","html_url":"https://github.com/intljusticemission","followers_url":"https://api.github.com/users/intljusticemission/followers","following_url":"https://api.github.com/users/intljusticemission/following{/other_user}","gists_url":"https://api.github.com/users/intljusticemission/gists{/gist_id}","starred_url":"https://api.github.com/users/intljusticemission/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/intljusticemission/subscriptions","organizations_url":"https://api.github.com/users/intljusticemission/orgs","repos_url":"https://api.github.com/users/intljusticemission/repos","events_url":"https://api.github.com/users/intljusticemission/events{/privacy}","received_events_url":"https://api.github.com/users/intljusticemission/received_events","type":"Organization","site_admin":false},"repo":{"id":41187219,"node_id":"MDEwOlJlcG9zaXRvcnk0MTE4NzIxOQ==","name":"react-big-calendar","full_name":"intljusticemission/react-big-calendar","private":false,"owner":{"login":"intljusticemission","id":5813881,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU4MTM4ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/5813881?v=4","gravatar_id":"","url":"https://api.github.com/users/intljusticemission","html_url":"https://github.com/intljusticemission","followers_url":"https://api.github.com/users/intljusticemission/followers","following_url":"https://api.github.com/users/intljusticemission/following{/other_user}","gists_url":"https://api.github.com/users/intljusticemission/gists{/gist_id}","starred_url":"https://api.github.com/users/intljusticemission/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/intljusticemission/subscriptions","organizations_url":"https://api.github.com/users/intljusticemission/orgs","repos_url":"https://api.github.com/users/intljusticemission/repos","events_url":"https://api.github.com/users/intljusticemission/events{/privacy}","received_events_url":"https://api.github.com/users/intljusticemission/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/intljusticemission/react-big-calendar","description":"gcal/outlook like calendar component","fork":false,"url":"https://api.github.com/repos/intljusticemission/react-big-calendar","forks_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/forks","keys_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/teams","hooks_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/hooks","issue_events_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/issues/events{/number}","events_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/events","assignees_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/assignees{/user}","branches_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/branches{/branch}","tags_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/tags","blobs_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/git/refs{/sha}","trees_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/statuses/{sha}","languages_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/languages","stargazers_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/stargazers","contributors_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/contributors","subscribers_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/subscribers","subscription_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/subscription","commits_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/commits{/sha}","git_commits_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/git/commits{/sha}","comments_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/comments{/number}","issue_comment_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/issues/comments{/number}","contents_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/contents/{+path}","compare_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/merges","archive_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/downloads","issues_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/issues{/number}","pulls_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls{/number}","milestones_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/milestones{/number}","notifications_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/labels{/name}","releases_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/releases{/id}","deployments_url":"https://api.github.com/repos/intljusticemission/react-big-calendar/deployments","created_at":"2015-08-22T02:56:58Z","updated_at":"2018-12-10T16:19:47Z","pushed_at":"2018-12-10T23:18:36Z","git_url":"git://github.com/intljusticemission/react-big-calendar.git","ssh_url":"git@github.com:intljusticemission/react-big-calendar.git","clone_url":"https://github.com/intljusticemission/react-big-calendar.git","svn_url":"https://github.com/intljusticemission/react-big-calendar","homepage":"http://intljusticemission.github.io/react-big-calendar/examples/index.html","size":8114,"stargazers_count":2694,"watchers_count":2694,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":935,"mirror_url":null,"archived":false,"open_issues_count":114,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":935,"open_issues":114,"watchers":2694,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123"},"html":{"href":"https://github.com/intljusticemission/react-big-calendar/pull/1123"},"issue":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/issues/1123"},"comments":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/issues/1123/comments"},"review_comments":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123/comments"},"review_comment":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/pulls/1123/commits"},"statuses":{"href":"https://api.github.com/repos/intljusticemission/react-big-calendar/statuses/1aac0619787da5c2c591909648112ce3b2c91f48"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"bs85"}}