{"action":"created","comment":{"url":"https://api.github.com/repos/basiljs/basil.js/pulls/comments/87748639","pull_request_review_id":8347464,"id":87748639,"diff_hunk":"@@ -1437,20 +1437,18 @@ pub.clear = function(container) {\n \n   if (container instanceof Document\n     || container instanceof Page\n-    || container instanceof Layer\n-    || container instanceof Group) {\n+    || container instanceof Layer) {\n \n-    return forEach(container.allPageItems, function(item, n) {\n-        // Groups have to be avoided for deletion\n-        // otherwise deletion process is confused\n-      if(item !== null && !(item instanceof Group)) {\n-        if(item.locked) error(\"b.clear(), some items are locked. Please unlock them first and sue then b.clear().\");\n-        item.remove();\n-      }\n-    });\n+    container.pageItems.everyItem().locked = false;\n+    container.pageItems.everyItem().remove();\n+\n+  } else if (container instanceof Group) {","path":"basil.js","position":34,"original_position":25,"commit_id":"09cf48d7bbdcd99a4c5248b6b4d2dadd819119cd","original_commit_id":"6761fb168f17020cc99694b237a32221dd923ebd","user":{"login":"fabianmoronzirfas","id":315106,"avatar_url":"https://avatars.githubusercontent.com/u/315106?v=3","gravatar_id":"","url":"https://api.github.com/users/fabianmoronzirfas","html_url":"https://github.com/fabianmoronzirfas","followers_url":"https://api.github.com/users/fabianmoronzirfas/followers","following_url":"https://api.github.com/users/fabianmoronzirfas/following{/other_user}","gists_url":"https://api.github.com/users/fabianmoronzirfas/gists{/gist_id}","starred_url":"https://api.github.com/users/fabianmoronzirfas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabianmoronzirfas/subscriptions","organizations_url":"https://api.github.com/users/fabianmoronzirfas/orgs","repos_url":"https://api.github.com/users/fabianmoronzirfas/repos","events_url":"https://api.github.com/users/fabianmoronzirfas/events{/privacy}","received_events_url":"https://api.github.com/users/fabianmoronzirfas/received_events","type":"User","site_admin":false},"body":"Mybe I was not clear enough. if we use `b.clear(page)` and there are groups on that page with other objects. Will we run into a problem? ","created_at":"2016-11-14T07:24:25Z","updated_at":"2016-11-14T07:24:25Z","html_url":"https://github.com/basiljs/basil.js/pull/132#discussion_r87748639","pull_request_url":"https://api.github.com/repos/basiljs/basil.js/pulls/132","_links":{"self":{"href":"https://api.github.com/repos/basiljs/basil.js/pulls/comments/87748639"},"html":{"href":"https://github.com/basiljs/basil.js/pull/132#discussion_r87748639"},"pull_request":{"href":"https://api.github.com/repos/basiljs/basil.js/pulls/132"}}},"pull_request":{"url":"https://api.github.com/repos/basiljs/basil.js/pulls/132","id":93458573,"html_url":"https://github.com/basiljs/basil.js/pull/132","diff_url":"https://github.com/basiljs/basil.js/pull/132.diff","patch_url":"https://github.com/basiljs/basil.js/pull/132.patch","issue_url":"https://api.github.com/repos/basiljs/basil.js/issues/132","number":132,"state":"open","locked":false,"title":"Speeding up b.clear()","user":{"login":"trych","id":9803905,"avatar_url":"https://avatars.githubusercontent.com/u/9803905?v=3","gravatar_id":"","url":"https://api.github.com/users/trych","html_url":"https://github.com/trych","followers_url":"https://api.github.com/users/trych/followers","following_url":"https://api.github.com/users/trych/following{/other_user}","gists_url":"https://api.github.com/users/trych/gists{/gist_id}","starred_url":"https://api.github.com/users/trych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trych/subscriptions","organizations_url":"https://api.github.com/users/trych/orgs","repos_url":"https://api.github.com/users/trych/repos","events_url":"https://api.github.com/users/trych/events{/privacy}","received_events_url":"https://api.github.com/users/trych/received_events","type":"User","site_admin":false},"body":"This PR speeds up `b.clear()` by avoiding the internal use of `b.forEach()`. A benchmark script `clearItems.jsx` is added to `test/benchmarks/`.\r\n\r\nOn my system the benchmark gave these results:\r\n\r\n```\r\nOld b.clear():\r\nClearing 500 grouped items: 8.066 seconds.\r\nClearing 500 items on page: 4.259 seconds.\r\nClearing 500 items on layer: 6.324 seconds.\r\nClearing 500 items in document: 2.749 seconds.\r\n```\r\n\r\n```\r\nNew b.clear():\r\nClearing 500 grouped items: 0.275 seconds.\r\nClearing 500 items on page: 0.589 seconds.\r\nClearing 500 items on layer: 0.561 seconds.\r\nClearing 500 items in document: 0.453 seconds.\r\n```\r\n\r\nThe more objects need to be deleted, the greater the speed difference. It is also greater if the objects are deleted from the active page as the page needs to be redrawn more often with the old `b.clear()`.\r\n\r\nIt passes all tests.","created_at":"2016-11-13T01:36:30Z","updated_at":"2016-11-14T07:24:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e5deb3dbc4c0fdb4124fa3e2cc3eef008e7c65c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/basiljs/basil.js/pulls/132/commits","review_comments_url":"https://api.github.com/repos/basiljs/basil.js/pulls/132/comments","review_comment_url":"https://api.github.com/repos/basiljs/basil.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/basiljs/basil.js/issues/132/comments","statuses_url":"https://api.github.com/repos/basiljs/basil.js/statuses/09cf48d7bbdcd99a4c5248b6b4d2dadd819119cd","head":{"label":"trych:clear","ref":"clear","sha":"09cf48d7bbdcd99a4c5248b6b4d2dadd819119cd","user":{"login":"trych","id":9803905,"avatar_url":"https://avatars.githubusercontent.com/u/9803905?v=3","gravatar_id":"","url":"https://api.github.com/users/trych","html_url":"https://github.com/trych","followers_url":"https://api.github.com/users/trych/followers","following_url":"https://api.github.com/users/trych/following{/other_user}","gists_url":"https://api.github.com/users/trych/gists{/gist_id}","starred_url":"https://api.github.com/users/trych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trych/subscriptions","organizations_url":"https://api.github.com/users/trych/orgs","repos_url":"https://api.github.com/users/trych/repos","events_url":"https://api.github.com/users/trych/events{/privacy}","received_events_url":"https://api.github.com/users/trych/received_events","type":"User","site_admin":false},"repo":{"id":62998252,"name":"basil.js","full_name":"trych/basil.js","owner":{"login":"trych","id":9803905,"avatar_url":"https://avatars.githubusercontent.com/u/9803905?v=3","gravatar_id":"","url":"https://api.github.com/users/trych","html_url":"https://github.com/trych","followers_url":"https://api.github.com/users/trych/followers","following_url":"https://api.github.com/users/trych/following{/other_user}","gists_url":"https://api.github.com/users/trych/gists{/gist_id}","starred_url":"https://api.github.com/users/trych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trych/subscriptions","organizations_url":"https://api.github.com/users/trych/orgs","repos_url":"https://api.github.com/users/trych/repos","events_url":"https://api.github.com/users/trych/events{/privacy}","received_events_url":"https://api.github.com/users/trych/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/trych/basil.js","description":"An attempt to port the spirit of the Processing visualization language to Adobe Indesign.","fork":true,"url":"https://api.github.com/repos/trych/basil.js","forks_url":"https://api.github.com/repos/trych/basil.js/forks","keys_url":"https://api.github.com/repos/trych/basil.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trych/basil.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trych/basil.js/teams","hooks_url":"https://api.github.com/repos/trych/basil.js/hooks","issue_events_url":"https://api.github.com/repos/trych/basil.js/issues/events{/number}","events_url":"https://api.github.com/repos/trych/basil.js/events","assignees_url":"https://api.github.com/repos/trych/basil.js/assignees{/user}","branches_url":"https://api.github.com/repos/trych/basil.js/branches{/branch}","tags_url":"https://api.github.com/repos/trych/basil.js/tags","blobs_url":"https://api.github.com/repos/trych/basil.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trych/basil.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trych/basil.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/trych/basil.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trych/basil.js/statuses/{sha}","languages_url":"https://api.github.com/repos/trych/basil.js/languages","stargazers_url":"https://api.github.com/repos/trych/basil.js/stargazers","contributors_url":"https://api.github.com/repos/trych/basil.js/contributors","subscribers_url":"https://api.github.com/repos/trych/basil.js/subscribers","subscription_url":"https://api.github.com/repos/trych/basil.js/subscription","commits_url":"https://api.github.com/repos/trych/basil.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/trych/basil.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/trych/basil.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/trych/basil.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/trych/basil.js/contents/{+path}","compare_url":"https://api.github.com/repos/trych/basil.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trych/basil.js/merges","archive_url":"https://api.github.com/repos/trych/basil.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trych/basil.js/downloads","issues_url":"https://api.github.com/repos/trych/basil.js/issues{/number}","pulls_url":"https://api.github.com/repos/trych/basil.js/pulls{/number}","milestones_url":"https://api.github.com/repos/trych/basil.js/milestones{/number}","notifications_url":"https://api.github.com/repos/trych/basil.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trych/basil.js/labels{/name}","releases_url":"https://api.github.com/repos/trych/basil.js/releases{/id}","deployments_url":"https://api.github.com/repos/trych/basil.js/deployments","created_at":"2016-07-10T12:46:59Z","updated_at":"2016-07-10T12:47:00Z","pushed_at":"2016-11-13T01:16:32Z","git_url":"git://github.com/trych/basil.js.git","ssh_url":"git@github.com:trych/basil.js.git","clone_url":"https://github.com/trych/basil.js.git","svn_url":"https://github.com/trych/basil.js","homepage":"http://basiljs.ch/","size":4517,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"base":{"label":"basiljs:develop","ref":"develop","sha":"9661ef944492d6194321881f021728a047e96b2c","user":{"login":"basiljs","id":1723409,"avatar_url":"https://avatars.githubusercontent.com/u/1723409?v=3","gravatar_id":"","url":"https://api.github.com/users/basiljs","html_url":"https://github.com/basiljs","followers_url":"https://api.github.com/users/basiljs/followers","following_url":"https://api.github.com/users/basiljs/following{/other_user}","gists_url":"https://api.github.com/users/basiljs/gists{/gist_id}","starred_url":"https://api.github.com/users/basiljs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basiljs/subscriptions","organizations_url":"https://api.github.com/users/basiljs/orgs","repos_url":"https://api.github.com/users/basiljs/repos","events_url":"https://api.github.com/users/basiljs/events{/privacy}","received_events_url":"https://api.github.com/users/basiljs/received_events","type":"Organization","site_admin":false},"repo":{"id":4337410,"name":"basil.js","full_name":"basiljs/basil.js","owner":{"login":"basiljs","id":1723409,"avatar_url":"https://avatars.githubusercontent.com/u/1723409?v=3","gravatar_id":"","url":"https://api.github.com/users/basiljs","html_url":"https://github.com/basiljs","followers_url":"https://api.github.com/users/basiljs/followers","following_url":"https://api.github.com/users/basiljs/following{/other_user}","gists_url":"https://api.github.com/users/basiljs/gists{/gist_id}","starred_url":"https://api.github.com/users/basiljs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basiljs/subscriptions","organizations_url":"https://api.github.com/users/basiljs/orgs","repos_url":"https://api.github.com/users/basiljs/repos","events_url":"https://api.github.com/users/basiljs/events{/privacy}","received_events_url":"https://api.github.com/users/basiljs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/basiljs/basil.js","description":"An attempt to port the spirit of the Processing visualization language to Adobe Indesign.","fork":false,"url":"https://api.github.com/repos/basiljs/basil.js","forks_url":"https://api.github.com/repos/basiljs/basil.js/forks","keys_url":"https://api.github.com/repos/basiljs/basil.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/basiljs/basil.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/basiljs/basil.js/teams","hooks_url":"https://api.github.com/repos/basiljs/basil.js/hooks","issue_events_url":"https://api.github.com/repos/basiljs/basil.js/issues/events{/number}","events_url":"https://api.github.com/repos/basiljs/basil.js/events","assignees_url":"https://api.github.com/repos/basiljs/basil.js/assignees{/user}","branches_url":"https://api.github.com/repos/basiljs/basil.js/branches{/branch}","tags_url":"https://api.github.com/repos/basiljs/basil.js/tags","blobs_url":"https://api.github.com/repos/basiljs/basil.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/basiljs/basil.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/basiljs/basil.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/basiljs/basil.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/basiljs/basil.js/statuses/{sha}","languages_url":"https://api.github.com/repos/basiljs/basil.js/languages","stargazers_url":"https://api.github.com/repos/basiljs/basil.js/stargazers","contributors_url":"https://api.github.com/repos/basiljs/basil.js/contributors","subscribers_url":"https://api.github.com/repos/basiljs/basil.js/subscribers","subscription_url":"https://api.github.com/repos/basiljs/basil.js/subscription","commits_url":"https://api.github.com/repos/basiljs/basil.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/basiljs/basil.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/basiljs/basil.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/basiljs/basil.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/basiljs/basil.js/contents/{+path}","compare_url":"https://api.github.com/repos/basiljs/basil.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/basiljs/basil.js/merges","archive_url":"https://api.github.com/repos/basiljs/basil.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/basiljs/basil.js/downloads","issues_url":"https://api.github.com/repos/basiljs/basil.js/issues{/number}","pulls_url":"https://api.github.com/repos/basiljs/basil.js/pulls{/number}","milestones_url":"https://api.github.com/repos/basiljs/basil.js/milestones{/number}","notifications_url":"https://api.github.com/repos/basiljs/basil.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/basiljs/basil.js/labels{/name}","releases_url":"https://api.github.com/repos/basiljs/basil.js/releases{/id}","deployments_url":"https://api.github.com/repos/basiljs/basil.js/deployments","created_at":"2012-05-15T15:34:05Z","updated_at":"2016-11-12T06:31:38Z","pushed_at":"2016-11-13T01:36:31Z","git_url":"git://github.com/basiljs/basil.js.git","ssh_url":"git@github.com:basiljs/basil.js.git","clone_url":"https://github.com/basiljs/basil.js.git","svn_url":"https://github.com/basiljs/basil.js","homepage":"http://basiljs.ch/","size":4640,"stargazers_count":134,"watchers_count":134,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":49,"forks":22,"open_issues":49,"watchers":134,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/basiljs/basil.js/pulls/132"},"html":{"href":"https://github.com/basiljs/basil.js/pull/132"},"issue":{"href":"https://api.github.com/repos/basiljs/basil.js/issues/132"},"comments":{"href":"https://api.github.com/repos/basiljs/basil.js/issues/132/comments"},"review_comments":{"href":"https://api.github.com/repos/basiljs/basil.js/pulls/132/comments"},"review_comment":{"href":"https://api.github.com/repos/basiljs/basil.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/basiljs/basil.js/pulls/132/commits"},"statuses":{"href":"https://api.github.com/repos/basiljs/basil.js/statuses/09cf48d7bbdcd99a4c5248b6b4d2dadd819119cd"}}}}
{"actor":{"display_login":"fabianmoronzirfas"}}