{"action":"created","comment":{"url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments/51681011","id":51681011,"diff_hunk":"@@ -174,24 +181,37 @@ def setValue(self, v):\n         #else:\n             #print \"ignore\", change\n         #return GraphicsObject.itemChange(self, change, val)\n-                \n+\n+    def viewTransformChanged(self):\n+        self._boundingRect = None\n+        self._line = None\n+        GraphicsObject.viewTransformChanged(self)\n+\n+    def viewChanged(self, view, oldView):","path":"pyqtgraph/graphicsItems/InfiniteLine.py","position":32,"original_position":32,"commit_id":"98ff70e8a04094d718d95508fa10e63323abe73b","original_commit_id":"98ff70e8a04094d718d95508fa10e63323abe73b","user":{"login":"campagnola","id":940580,"avatar_url":"https://avatars.githubusercontent.com/u/940580?v=3","gravatar_id":"","url":"https://api.github.com/users/campagnola","html_url":"https://github.com/campagnola","followers_url":"https://api.github.com/users/campagnola/followers","following_url":"https://api.github.com/users/campagnola/following{/other_user}","gists_url":"https://api.github.com/users/campagnola/gists{/gist_id}","starred_url":"https://api.github.com/users/campagnola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/campagnola/subscriptions","organizations_url":"https://api.github.com/users/campagnola/orgs","repos_url":"https://api.github.com/users/campagnola/repos","events_url":"https://api.github.com/users/campagnola/events{/privacy}","received_events_url":"https://api.github.com/users/campagnola/received_events","type":"User","site_admin":false},"body":"Overriding `viewChanged` should be unnecessary--this will automatically call `viewTransformChanged` as well.","created_at":"2016-02-03T05:45:48Z","updated_at":"2016-02-03T05:45:48Z","html_url":"https://github.com/pyqtgraph/pyqtgraph/pull/275#discussion_r51681011","pull_request_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275","_links":{"self":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments/51681011"},"html":{"href":"https://github.com/pyqtgraph/pyqtgraph/pull/275#discussion_r51681011"},"pull_request":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275"}}},"pull_request":{"url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275","id":57995084,"html_url":"https://github.com/pyqtgraph/pyqtgraph/pull/275","diff_url":"https://github.com/pyqtgraph/pyqtgraph/pull/275.diff","patch_url":"https://github.com/pyqtgraph/pyqtgraph/pull/275.patch","issue_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/275","number":275,"state":"open","locked":false,"title":"Improve InfiniteLine drawing performance by caching the line and bounding rect.","user":{"login":"allebacco","id":11872072,"avatar_url":"https://avatars.githubusercontent.com/u/11872072?v=3","gravatar_id":"","url":"https://api.github.com/users/allebacco","html_url":"https://github.com/allebacco","followers_url":"https://api.github.com/users/allebacco/followers","following_url":"https://api.github.com/users/allebacco/following{/other_user}","gists_url":"https://api.github.com/users/allebacco/gists{/gist_id}","starred_url":"https://api.github.com/users/allebacco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allebacco/subscriptions","organizations_url":"https://api.github.com/users/allebacco/orgs","repos_url":"https://api.github.com/users/allebacco/repos","events_url":"https://api.github.com/users/allebacco/events{/privacy}","received_events_url":"https://api.github.com/users/allebacco/received_events","type":"User","site_admin":false},"body":"This PR is for improving `InfiniteLine` drawing performance by caching the line and the bounding rect.\r\nThe performance has been improved for situations in which items close to the `InfiniteLine` are changing.\r\n\r\nPlease, try the following code before and after the PR to have an idea of the improvements.\r\n```\r\n#!/usr/bin/python\r\n\r\nfrom pyqtgraph.Qt import QtGui, QtCore\r\nimport numpy as np\r\nimport pyqtgraph as pg\r\nfrom pyqtgraph.ptime import time\r\napp = QtGui.QApplication([])\r\n\r\np = pg.plot()\r\np.setWindowTitle('pyqtgraph performance: InfiniteLine')\r\np.setRange(QtCore.QRectF(0, -10, 5000, 20))\r\np.setLabel('bottom', 'Index', units='B')\r\ncurve = p.plot()\r\n\r\n# Add a large number of horizontal InfiniteLine to plot\r\nfor i in range(100):\r\n    line = pg.InfiniteLine(pos=np.random.randint(5000), movable=True)\r\n    p.addItem(line)\r\n\r\ndata = np.random.normal(size=(50, 5000))\r\nptr = 0\r\nlastTime = time()\r\nfps = None\r\n\r\n\r\ndef update():\r\n    global curve, data, ptr, p, lastTime, fps\r\n    curve.setData(data[ptr % 10])\r\n    ptr += 1\r\n    now = time()\r\n    dt = now - lastTime\r\n    lastTime = now\r\n    if fps is None:\r\n        fps = 1.0/dt\r\n    else:\r\n        s = np.clip(dt*3., 0, 1)\r\n        fps = fps * (1-s) + (1.0/dt) * s\r\n    p.setTitle('%0.2f fps' % fps)\r\n    app.processEvents()  # force complete redraw for every plot\r\n\r\n\r\ntimer = QtCore.QTimer()\r\ntimer.timeout.connect(update)\r\ntimer.start(0)\r\n\r\n\r\n# Start Qt event loop unless running in interactive mode.\r\nif __name__ == '__main__':\r\n    import sys\r\n    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):\r\n        QtGui.QApplication.instance().exec_()\r\n```","created_at":"2016-02-02T14:39:25Z","updated_at":"2016-02-03T05:45:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36f29363a95d85166b2e4c2d1215fac8011d2e5b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275/commits","review_comments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275/comments","review_comment_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/275/comments","statuses_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/statuses/98ff70e8a04094d718d95508fa10e63323abe73b","head":{"label":"henesissrl:infinite_line_speedup","ref":"infinite_line_speedup","sha":"98ff70e8a04094d718d95508fa10e63323abe73b","user":{"login":"henesissrl","id":12099337,"avatar_url":"https://avatars.githubusercontent.com/u/12099337?v=3","gravatar_id":"","url":"https://api.github.com/users/henesissrl","html_url":"https://github.com/henesissrl","followers_url":"https://api.github.com/users/henesissrl/followers","following_url":"https://api.github.com/users/henesissrl/following{/other_user}","gists_url":"https://api.github.com/users/henesissrl/gists{/gist_id}","starred_url":"https://api.github.com/users/henesissrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henesissrl/subscriptions","organizations_url":"https://api.github.com/users/henesissrl/orgs","repos_url":"https://api.github.com/users/henesissrl/repos","events_url":"https://api.github.com/users/henesissrl/events{/privacy}","received_events_url":"https://api.github.com/users/henesissrl/received_events","type":"Organization","site_admin":false},"repo":{"id":46565429,"name":"pyqtgraph","full_name":"henesissrl/pyqtgraph","owner":{"login":"henesissrl","id":12099337,"avatar_url":"https://avatars.githubusercontent.com/u/12099337?v=3","gravatar_id":"","url":"https://api.github.com/users/henesissrl","html_url":"https://github.com/henesissrl","followers_url":"https://api.github.com/users/henesissrl/followers","following_url":"https://api.github.com/users/henesissrl/following{/other_user}","gists_url":"https://api.github.com/users/henesissrl/gists{/gist_id}","starred_url":"https://api.github.com/users/henesissrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henesissrl/subscriptions","organizations_url":"https://api.github.com/users/henesissrl/orgs","repos_url":"https://api.github.com/users/henesissrl/repos","events_url":"https://api.github.com/users/henesissrl/events{/privacy}","received_events_url":"https://api.github.com/users/henesissrl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/henesissrl/pyqtgraph","description":"pyqtgraph main development repository","fork":true,"url":"https://api.github.com/repos/henesissrl/pyqtgraph","forks_url":"https://api.github.com/repos/henesissrl/pyqtgraph/forks","keys_url":"https://api.github.com/repos/henesissrl/pyqtgraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henesissrl/pyqtgraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henesissrl/pyqtgraph/teams","hooks_url":"https://api.github.com/repos/henesissrl/pyqtgraph/hooks","issue_events_url":"https://api.github.com/repos/henesissrl/pyqtgraph/issues/events{/number}","events_url":"https://api.github.com/repos/henesissrl/pyqtgraph/events","assignees_url":"https://api.github.com/repos/henesissrl/pyqtgraph/assignees{/user}","branches_url":"https://api.github.com/repos/henesissrl/pyqtgraph/branches{/branch}","tags_url":"https://api.github.com/repos/henesissrl/pyqtgraph/tags","blobs_url":"https://api.github.com/repos/henesissrl/pyqtgraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henesissrl/pyqtgraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henesissrl/pyqtgraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/henesissrl/pyqtgraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henesissrl/pyqtgraph/statuses/{sha}","languages_url":"https://api.github.com/repos/henesissrl/pyqtgraph/languages","stargazers_url":"https://api.github.com/repos/henesissrl/pyqtgraph/stargazers","contributors_url":"https://api.github.com/repos/henesissrl/pyqtgraph/contributors","subscribers_url":"https://api.github.com/repos/henesissrl/pyqtgraph/subscribers","subscription_url":"https://api.github.com/repos/henesissrl/pyqtgraph/subscription","commits_url":"https://api.github.com/repos/henesissrl/pyqtgraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/henesissrl/pyqtgraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/henesissrl/pyqtgraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/henesissrl/pyqtgraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/henesissrl/pyqtgraph/contents/{+path}","compare_url":"https://api.github.com/repos/henesissrl/pyqtgraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henesissrl/pyqtgraph/merges","archive_url":"https://api.github.com/repos/henesissrl/pyqtgraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henesissrl/pyqtgraph/downloads","issues_url":"https://api.github.com/repos/henesissrl/pyqtgraph/issues{/number}","pulls_url":"https://api.github.com/repos/henesissrl/pyqtgraph/pulls{/number}","milestones_url":"https://api.github.com/repos/henesissrl/pyqtgraph/milestones{/number}","notifications_url":"https://api.github.com/repos/henesissrl/pyqtgraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henesissrl/pyqtgraph/labels{/name}","releases_url":"https://api.github.com/repos/henesissrl/pyqtgraph/releases{/id}","deployments_url":"https://api.github.com/repos/henesissrl/pyqtgraph/deployments","created_at":"2015-11-20T14:06:38Z","updated_at":"2016-01-26T14:44:54Z","pushed_at":"2016-02-02T14:33:09Z","git_url":"git://github.com/henesissrl/pyqtgraph.git","ssh_url":"git@github.com:henesissrl/pyqtgraph.git","clone_url":"https://github.com/henesissrl/pyqtgraph.git","svn_url":"https://github.com/henesissrl/pyqtgraph","homepage":null,"size":3339,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"pyqtgraph:develop","ref":"develop","sha":"fd7644345883d1a5d484c3fe4abcbf06f5c3c3b0","user":{"login":"pyqtgraph","id":5440571,"avatar_url":"https://avatars.githubusercontent.com/u/5440571?v=3","gravatar_id":"","url":"https://api.github.com/users/pyqtgraph","html_url":"https://github.com/pyqtgraph","followers_url":"https://api.github.com/users/pyqtgraph/followers","following_url":"https://api.github.com/users/pyqtgraph/following{/other_user}","gists_url":"https://api.github.com/users/pyqtgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/pyqtgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyqtgraph/subscriptions","organizations_url":"https://api.github.com/users/pyqtgraph/orgs","repos_url":"https://api.github.com/users/pyqtgraph/repos","events_url":"https://api.github.com/users/pyqtgraph/events{/privacy}","received_events_url":"https://api.github.com/users/pyqtgraph/received_events","type":"Organization","site_admin":false},"repo":{"id":12777496,"name":"pyqtgraph","full_name":"pyqtgraph/pyqtgraph","owner":{"login":"pyqtgraph","id":5440571,"avatar_url":"https://avatars.githubusercontent.com/u/5440571?v=3","gravatar_id":"","url":"https://api.github.com/users/pyqtgraph","html_url":"https://github.com/pyqtgraph","followers_url":"https://api.github.com/users/pyqtgraph/followers","following_url":"https://api.github.com/users/pyqtgraph/following{/other_user}","gists_url":"https://api.github.com/users/pyqtgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/pyqtgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyqtgraph/subscriptions","organizations_url":"https://api.github.com/users/pyqtgraph/orgs","repos_url":"https://api.github.com/users/pyqtgraph/repos","events_url":"https://api.github.com/users/pyqtgraph/events{/privacy}","received_events_url":"https://api.github.com/users/pyqtgraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pyqtgraph/pyqtgraph","description":"pyqtgraph main development repository","fork":false,"url":"https://api.github.com/repos/pyqtgraph/pyqtgraph","forks_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/forks","keys_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/teams","hooks_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/hooks","issue_events_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/events{/number}","events_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/events","assignees_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/assignees{/user}","branches_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/branches{/branch}","tags_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/tags","blobs_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/statuses/{sha}","languages_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/languages","stargazers_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/stargazers","contributors_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/contributors","subscribers_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/subscribers","subscription_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/subscription","commits_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/contents/{+path}","compare_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/merges","archive_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/downloads","issues_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues{/number}","pulls_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls{/number}","milestones_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/milestones{/number}","notifications_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/labels{/name}","releases_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/releases{/id}","deployments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/deployments","created_at":"2013-09-12T07:18:21Z","updated_at":"2016-01-30T17:36:17Z","pushed_at":"2016-02-02T14:39:25Z","git_url":"git://github.com/pyqtgraph/pyqtgraph.git","ssh_url":"git@github.com:pyqtgraph/pyqtgraph.git","clone_url":"https://github.com/pyqtgraph/pyqtgraph.git","svn_url":"https://github.com/pyqtgraph/pyqtgraph","homepage":null,"size":4673,"stargazers_count":337,"watchers_count":337,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":188,"mirror_url":null,"open_issues_count":138,"forks":188,"open_issues":138,"watchers":337,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275"},"html":{"href":"https://github.com/pyqtgraph/pyqtgraph/pull/275"},"issue":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/275"},"comments":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/275/comments"},"review_comments":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275/comments"},"review_comment":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/275/commits"},"statuses":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/statuses/98ff70e8a04094d718d95508fa10e63323abe73b"}}}}