{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/5595","labels_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5595/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5595/comments","events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5595/events","html_url":"https://github.com/mozilla/pdf.js/pull/5595","id":53059621,"number":5595,"title":"Use binary search in getVisibleElements()","user":{"login":"fkaelberer","id":4624768,"avatar_url":"https://avatars.githubusercontent.com/u/4624768?v=3","gravatar_id":"","url":"https://api.github.com/users/fkaelberer","html_url":"https://github.com/fkaelberer","followers_url":"https://api.github.com/users/fkaelberer/followers","following_url":"https://api.github.com/users/fkaelberer/following{/other_user}","gists_url":"https://api.github.com/users/fkaelberer/gists{/gist_id}","starred_url":"https://api.github.com/users/fkaelberer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fkaelberer/subscriptions","organizations_url":"https://api.github.com/users/fkaelberer/orgs","repos_url":"https://api.github.com/users/fkaelberer/repos","events_url":"https://api.github.com/users/fkaelberer/events{/privacy}","received_events_url":"https://api.github.com/users/fkaelberer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/pdf.js/labels/1-viewer","name":"1-viewer","color":"DDDDDD"},{"url":"https://api.github.com/repos/mozilla/pdf.js/labels/2-performance","name":"2-performance","color":"02e10c"}],"state":"open","locked":false,"assignee":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"milestone":null,"comments":18,"created_at":"2014-12-29T18:22:50Z","updated_at":"2015-03-10T04:11:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mozilla/pdf.js/pulls/5595","html_url":"https://github.com/mozilla/pdf.js/pull/5595","diff_url":"https://github.com/mozilla/pdf.js/pull/5595.diff","patch_url":"https://github.com/mozilla/pdf.js/pull/5595.patch"},"body":"The method ```getVisibleElements()``` uses a linear search to find the first page and thumbnail in the visible range. It is called on every scroll event, so it can take a noticeable amount of time for the bottom pages of a very large document.\r\nThis PR replaces the linear search with a binary one (which needs O(log n) time).\r\n\r\nA good test:\r\n[3] [pdf](http://www.etsi.org/deliver/etsi_ts/151000_151099/15101001/10.03.00_60/ts_15101001v100300p.pdf) (5000+ pages)\r\n\r\nA benchmark:\r\nScrolling through pages 5500 to 5515 of [3], using the ```↓``` key, Linux, Firefox Nightly 37.0a1, ```textLayer=off```\r\nBefore:\r\n![linearsearch2](https://cloud.githubusercontent.com/assets/4624768/5571239/c6a01f66-8f8e-11e4-91af-b79fc2b00df2.png)\r\nAfter:\r\n![binarysearch2](https://cloud.githubusercontent.com/assets/4624768/5571240/ca4d0b74-8f8e-11e4-9493-b2de8375a63b.png)\r\n\r\n(Admittedly, the document has to be very large to notice a difference, but it should be more pronounced on slow devices)."},"comment":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/comments/77993021","html_url":"https://github.com/mozilla/pdf.js/pull/5595#issuecomment-77993021","issue_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5595","id":77993021,"user":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"created_at":"2015-03-10T04:11:00Z","updated_at":"2015-03-10T04:11:00Z","body":"/botio-windows unittest"}}