{"action":"created","issue":{"url":"https://api.github.com/repos/codemirror/CodeMirror/issues/4339","repository_url":"https://api.github.com/repos/codemirror/CodeMirror","labels_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/4339/labels{/name}","comments_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/4339/comments","events_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/4339/events","html_url":"https://github.com/codemirror/CodeMirror/pull/4339","id":184470298,"number":4339,"title":"Coordinate DOM updates across multiple CodeMirror instances.","user":{"login":"sedwards2009","id":6926644,"avatar_url":"https://avatars.githubusercontent.com/u/6926644?v=3","gravatar_id":"","url":"https://api.github.com/users/sedwards2009","html_url":"https://github.com/sedwards2009","followers_url":"https://api.github.com/users/sedwards2009/followers","following_url":"https://api.github.com/users/sedwards2009/following{/other_user}","gists_url":"https://api.github.com/users/sedwards2009/gists{/gist_id}","starred_url":"https://api.github.com/users/sedwards2009/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sedwards2009/subscriptions","organizations_url":"https://api.github.com/users/sedwards2009/orgs","repos_url":"https://api.github.com/users/sedwards2009/repos","events_url":"https://api.github.com/users/sedwards2009/events{/privacy}","received_events_url":"https://api.github.com/users/sedwards2009/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-21T12:09:20Z","updated_at":"2016-10-21T12:51:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/codemirror/CodeMirror/pulls/4339","html_url":"https://github.com/codemirror/CodeMirror/pull/4339","diff_url":"https://github.com/codemirror/CodeMirror/pull/4339.diff","patch_url":"https://github.com/codemirror/CodeMirror/pull/4339.patch"},"body":"My application Extraterm https://github.com/sedwards2009/extraterm uses CodeMirror a lot. \"A lot\" meaning that typical terminal tab may contain 10s to 100s of CM instances interleaved with other content. This works quite well except for things which affect the whole terminal tab and scrollback. For example, resizing and refreshing CSS styles. I'm looking for ways to speed up these kinds of bulk operations across multiple CM instances.\r\n\r\nThis pull request adds a `cm.coordinatedOperation()` method which allows for the coordinated update of the DOM across multiple CodeMirror instances. When CM finishes an operation updates the DOM, it will try to group DOM reads and writes into batches so as to avoid DOM thrashing. (I'm referring to the `endOperation_R1`, `endOperation_W1`, `endOperation_R2`, `endOperation_W2` functions.) `coordinatedOperation()` lets the caller operate on multiple CM instances and then execute all of the instances' `endOperation_R1` functions, then all of the `endOperation_W1` functions etc etc. This groups the update operations.\r\n\r\nThis chrome time line below shows the performance differences when using 100 CM instances. Normal `cm.refresh()` vs `cm.refresh()` with `coordinatedOperation()`, and also `cm.setSize(null,null)` vs the same using `coordinatedOperation()`.\r\n\r\n![codemirror_coordinated_operation_stats](https://cloud.githubusercontent.com/assets/6926644/19597867/8a96c28c-9797-11e6-9d33-52cc18c66ab3.png)\r\n"},"comment":{"url":"https://api.github.com/repos/codemirror/CodeMirror/issues/comments/255369977","html_url":"https://github.com/codemirror/CodeMirror/pull/4339#issuecomment-255369977","issue_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/4339","id":255369977,"user":{"login":"marijnh","id":144427,"avatar_url":"https://avatars.githubusercontent.com/u/144427?v=3","gravatar_id":"","url":"https://api.github.com/users/marijnh","html_url":"https://github.com/marijnh","followers_url":"https://api.github.com/users/marijnh/followers","following_url":"https://api.github.com/users/marijnh/following{/other_user}","gists_url":"https://api.github.com/users/marijnh/gists{/gist_id}","starred_url":"https://api.github.com/users/marijnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marijnh/subscriptions","organizations_url":"https://api.github.com/users/marijnh/orgs","repos_url":"https://api.github.com/users/marijnh/repos","events_url":"https://api.github.com/users/marijnh/events{/privacy}","received_events_url":"https://api.github.com/users/marijnh/received_events","type":"User","site_admin":false},"created_at":"2016-10-21T12:51:35Z","updated_at":"2016-10-21T12:51:35Z","body":"No, operations are created implicitly for any method call that requires them, so you only need one wrapping `operation` call, and anything you do inside of that, to any number of instances, will be grouped."}}
{"actor":{"display_login":"marijnh"}}