{"action":"created","comment":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/206674474","pull_request_review_id":142134081,"id":206674474,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjY3NDQ3NA==","diff_hunk":"@@ -360,22 +359,26 @@ function clearViewport(comp, vp) {\n     gl.clear(gl.COLOR_BUFFER_BIT);\n }\n \n+function repeat(opt, cnt) {\n+    var opts = new Array(cnt);\n+    for(var i = 0; i < cnt; i++) {\n+        opts[i] = opt;\n+    }\n+    return opts;\n+}","path":"src/traces/scattergl/index.js","position":135,"original_position":93,"commit_id":"a0bfaf36fe7406b3868ed882c09c73e71074999f","original_commit_id":"69dc0c429e997e470a926467d18a616b63dfa7eb","user":{"login":"alexcjohnson","id":2678795,"node_id":"MDQ6VXNlcjI2Nzg3OTU=","avatar_url":"https://avatars3.githubusercontent.com/u/2678795?v=4","gravatar_id":"","url":"https://api.github.com/users/alexcjohnson","html_url":"https://github.com/alexcjohnson","followers_url":"https://api.github.com/users/alexcjohnson/followers","following_url":"https://api.github.com/users/alexcjohnson/following{/other_user}","gists_url":"https://api.github.com/users/alexcjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcjohnson/subscriptions","organizations_url":"https://api.github.com/users/alexcjohnson/orgs","repos_url":"https://api.github.com/users/alexcjohnson/repos","events_url":"https://api.github.com/users/alexcjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/alexcjohnson/received_events","type":"User","site_admin":false},"body":"non blocking, would probably make a good `Lib` function. Pretty sure we use this in other places as well, though I'm not quite sure how to search for it...","created_at":"2018-07-31T20:35:22Z","updated_at":"2018-07-31T20:35:22Z","html_url":"https://github.com/plotly/plotly.js/pull/2860#discussion_r206674474","pull_request_url":"https://api.github.com/repos/plotly/plotly.js/pulls/2860","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/206674474"},"html":{"href":"https://github.com/plotly/plotly.js/pull/2860#discussion_r206674474"},"pull_request":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2860"}}},"pull_request":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/2860","id":205219781,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1MjE5Nzgx","html_url":"https://github.com/plotly/plotly.js/pull/2860","diff_url":"https://github.com/plotly/plotly.js/pull/2860.diff","patch_url":"https://github.com/plotly/plotly.js/pull/2860.patch","issue_url":"https://api.github.com/repos/plotly/plotly.js/issues/2860","number":2860,"state":"open","locked":false,"title":"Recycled commits from abandoned fast trace toggle PRs","user":{"login":"etpinard","id":6675409,"node_id":"MDQ6VXNlcjY2NzU0MDk=","avatar_url":"https://avatars0.githubusercontent.com/u/6675409?v=4","gravatar_id":"","url":"https://api.github.com/users/etpinard","html_url":"https://github.com/etpinard","followers_url":"https://api.github.com/users/etpinard/followers","following_url":"https://api.github.com/users/etpinard/following{/other_user}","gists_url":"https://api.github.com/users/etpinard/gists{/gist_id}","starred_url":"https://api.github.com/users/etpinard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etpinard/subscriptions","organizations_url":"https://api.github.com/users/etpinard/orgs","repos_url":"https://api.github.com/users/etpinard/repos","events_url":"https://api.github.com/users/etpinard/events{/privacy}","received_events_url":"https://api.github.com/users/etpinard/received_events","type":"User","site_admin":false},"body":"based of https://github.com/plotly/plotly.js/pull/2823, supersedes https://github.com/plotly/plotly.js/pull/2837 and https://github.com/plotly/plotly.js/pull/2849.\r\n\r\nI decided to abandoned the fast trace toggle PRs after https://github.com/plotly/plotly.js/pull/2849#issuecomment-408958619 and realizing that even a special `'legendonly'` pathway wouldn't be enough (it would break categorical axes).\r\n\r\nSo, this PR attempts to :recycle: some of the work done in the past week, some of which have small but noticeable performance benefits.\r\n\r\nNamely,\r\n\r\n- `fullLayout._modules` now includes trace modules of `visible!==true` traces. In particular, this leads to `fullLayout._has('gl')` returning `true` and some performance benefits for scattergl traces. For example, \r\n\r\n```js\r\nPlotly.restyle(gd, 'visible', false)\r\nsetTimeout(() => {\r\n  console.time('1')\r\n  Plotly.restyle(gd, 'visible', true)\r\n  console.timeEnd('1')\r\n}, 500)\r\n```\r\n\r\nis 100ms faster now for scattergl graphs (no matter the number of points) as we no longer clear and reinit a WebGL context.\r\n\r\n- `Axes.expand` and `ax._min`/`ax._max` are replaced by `findExtremes` and `_extremes` containers in full trace and annotations/shapes items. Arguably, this improves maintenance as `findExtremes` does not mutate the full axis objects; it should make it easier to reuse `cartesian/autorange.js` in other subplot types. Moreover, this appears to have some performance benefits, perhaps as the pseudo O(n^2) `expand`/`findExtremes` algo is now done over a per-trace-not-axis-wide sample. For example, with\r\n\r\n```js\r\n// this is the largest N before we use the average marker.size\r\n// one Axes.expand / findExtremes call here clocks in at 20-50ms on average\r\nvar N = 1e5-1\r\nvar N2 = 1e5-1\r\n\r\nvar x = []\r\nvar y = []\r\nvar ms = []\r\nvar x2 = []\r\nvar y2 = []\r\nvar ms2 = []\r\nvar i\r\n\r\nfor(i = 0; i < N; i++) {\r\n  x.push(Math.random())\r\n  y.push(Math.random())\r\n  ms.push(i % 2 ? 20 : 10)\r\n}\r\nfor(i = 0; i < N2; i++) {  \r\n  x2.push(Math.random() + 2)\r\n  y2.push(Math.random())\r\n  ms2.push(i % 2 ? 10 : 20)\r\n}\r\n\r\nPlotly.newPlot('graph', [{\r\n  type: 'scattergl',\r\n  mode: 'markers',\r\n  x: x, y: y,\r\n  marker: {size: ms}\r\n}, {\r\n  type: 'scattergl',\r\n  mode: 'markers',\r\n  x: x2, y: y2,\r\n  marker: {size: ms2}\r\n}])\r\n```\r\n\r\nThe sum of the `findExtremes` computation times (2 per x/y axes) appear 10ms faster than  the corresponding `Axes.expand` calls on master. Note that `Axes.getAutorange` is 10x slower on this branch (most likely from concatenating trace `_extremes`), but still clocks in well below the 1ms mark.\r\n\r\n- finally, this PR adds several tests the assert axis range after `visible` restyles.\r\n\r\n**But**, please note this PR does **not** attempt to make trace and annotations/shapes `visible` a `'plot'` edit type. They will remain a :turtle: 'calc' edit type for the next few months :disappointed: \r\n\r\ncc @alexcjohnson ","created_at":"2018-07-31T19:37:14Z","updated_at":"2018-07-31T20:35:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a95913384c8269d21a339f0e094b96e874dc6df0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":330750748,"node_id":"MDU6TGFiZWwzMzA3NTA3NDg=","url":"https://api.github.com/repos/plotly/plotly.js/labels/status:%20reviewable","name":"status: reviewable","color":"33a02c","default":false},{"id":330749982,"node_id":"MDU6TGFiZWwzMzA3NDk5ODI=","url":"https://api.github.com/repos/plotly/plotly.js/labels/type:%20maintenance","name":"type: maintenance","color":"ff7f00","default":false},{"id":356286388,"node_id":"MDU6TGFiZWwzNTYyODYzODg=","url":"https://api.github.com/repos/plotly/plotly.js/labels/type:%20performance","name":"type: performance","color":"fdbf6f","default":false}],"milestone":{"url":"https://api.github.com/repos/plotly/plotly.js/milestones/36","html_url":"https://github.com/plotly/plotly.js/milestone/36","labels_url":"https://api.github.com/repos/plotly/plotly.js/milestones/36/labels","id":3507060,"node_id":"MDk6TWlsZXN0b25lMzUwNzA2MA==","number":36,"title":"v1.40.0","description":"","creator":{"login":"etpinard","id":6675409,"node_id":"MDQ6VXNlcjY2NzU0MDk=","avatar_url":"https://avatars0.githubusercontent.com/u/6675409?v=4","gravatar_id":"","url":"https://api.github.com/users/etpinard","html_url":"https://github.com/etpinard","followers_url":"https://api.github.com/users/etpinard/followers","following_url":"https://api.github.com/users/etpinard/following{/other_user}","gists_url":"https://api.github.com/users/etpinard/gists{/gist_id}","starred_url":"https://api.github.com/users/etpinard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etpinard/subscriptions","organizations_url":"https://api.github.com/users/etpinard/orgs","repos_url":"https://api.github.com/users/etpinard/repos","events_url":"https://api.github.com/users/etpinard/events{/privacy}","received_events_url":"https://api.github.com/users/etpinard/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":2,"state":"open","created_at":"2018-07-18T17:46:02Z","updated_at":"2018-07-31T19:38:03Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/plotly/plotly.js/pulls/2860/commits","review_comments_url":"https://api.github.com/repos/plotly/plotly.js/pulls/2860/comments","review_comment_url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plotly/plotly.js/issues/2860/comments","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/a0bfaf36fe7406b3868ed882c09c73e71074999f","head":{"label":"plotly:per-trace-ax-extremes-maintenance","ref":"per-trace-ax-extremes-maintenance","sha":"a0bfaf36fe7406b3868ed882c09c73e71074999f","user":{"login":"plotly","id":5997976,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5OTc5NzY=","avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"node_id":"MDEwOlJlcG9zaXRvcnk0NTY0NjAzNw==","name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5OTc5NzY=","avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source JavaScript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2018-07-31T14:59:42Z","pushed_at":"2018-07-31T20:30:35Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":429015,"stargazers_count":8664,"watchers_count":8664,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":995,"mirror_url":null,"archived":false,"open_issues_count":509,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":995,"open_issues":509,"watchers":8664,"default_branch":"master"}},"base":{"label":"plotly:faster-axis-autorange","ref":"faster-axis-autorange","sha":"1cdc36bdfbaaed53195d712d018cbf9a76561a7e","user":{"login":"plotly","id":5997976,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5OTc5NzY=","avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"node_id":"MDEwOlJlcG9zaXRvcnk0NTY0NjAzNw==","name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5OTc5NzY=","avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source JavaScript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2018-07-31T14:59:42Z","pushed_at":"2018-07-31T20:30:35Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":429015,"stargazers_count":8664,"watchers_count":8664,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":995,"mirror_url":null,"archived":false,"open_issues_count":509,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":995,"open_issues":509,"watchers":8664,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2860"},"html":{"href":"https://github.com/plotly/plotly.js/pull/2860"},"issue":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/2860"},"comments":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/2860/comments"},"review_comments":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2860/comments"},"review_comment":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2860/commits"},"statuses":{"href":"https://api.github.com/repos/plotly/plotly.js/statuses/a0bfaf36fe7406b3868ed882c09c73e71074999f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"alexcjohnson"}}