{"action":"created","issue":{"url":"https://api.github.com/repos/mobile-shell/mosh/issues/531","labels_url":"https://api.github.com/repos/mobile-shell/mosh/issues/531/labels{/name}","comments_url":"https://api.github.com/repos/mobile-shell/mosh/issues/531/comments","events_url":"https://api.github.com/repos/mobile-shell/mosh/issues/531/events","html_url":"https://github.com/mobile-shell/mosh/pull/531","id":35740190,"number":531,"title":"  Performance improvements for Terminal::Framebuffer and Terminal::Display","user":{"login":"cgull","id":1934797,"avatar_url":"https://avatars.githubusercontent.com/u/1934797?v=3","gravatar_id":"","url":"https://api.github.com/users/cgull","html_url":"https://github.com/cgull","followers_url":"https://api.github.com/users/cgull/followers","following_url":"https://api.github.com/users/cgull/following{/other_user}","gists_url":"https://api.github.com/users/cgull/gists{/gist_id}","starred_url":"https://api.github.com/users/cgull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgull/subscriptions","organizations_url":"https://api.github.com/users/cgull/orgs","repos_url":"https://api.github.com/users/cgull/repos","events_url":"https://api.github.com/users/cgull/events{/privacy}","received_events_url":"https://api.github.com/users/cgull/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/mobile-shell/mosh/milestones/4","html_url":"https://github.com/mobile-shell/mosh/milestones/mosh-1.2.6","labels_url":"https://api.github.com/repos/mobile-shell/mosh/milestones/4/labels","id":1181899,"number":4,"title":"mosh-1.2.6","description":"Currently I envision mosh-1.2.6 as a release that pulls in new features that improve Mosh, but are highly compatible with previous versions of Mosh and don't change Mosh's security architecture or expand its attack surface (or to put it another way, aren't controversial).  Of course it will pull in bug fixes and portability/packaging improvements too.\r\n","creator":{"login":"cgull","id":1934797,"avatar_url":"https://avatars.githubusercontent.com/u/1934797?v=3","gravatar_id":"","url":"https://api.github.com/users/cgull","html_url":"https://github.com/cgull","followers_url":"https://api.github.com/users/cgull/followers","following_url":"https://api.github.com/users/cgull/following{/other_user}","gists_url":"https://api.github.com/users/cgull/gists{/gist_id}","starred_url":"https://api.github.com/users/cgull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgull/subscriptions","organizations_url":"https://api.github.com/users/cgull/orgs","repos_url":"https://api.github.com/users/cgull/repos","events_url":"https://api.github.com/users/cgull/events{/privacy}","received_events_url":"https://api.github.com/users/cgull/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-06-26T00:24:19Z","updated_at":"2015-06-26T00:43:45Z","due_on":null,"closed_at":null},"comments":35,"created_at":"2014-06-15T01:20:01Z","updated_at":"2015-12-03T00:20:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mobile-shell/mosh/pulls/531","html_url":"https://github.com/mobile-shell/mosh/pull/531","diff_url":"https://github.com/mobile-shell/mosh/pull/531.diff","patch_url":"https://github.com/mobile-shell/mosh/pull/531.patch"},"body":"This replaces pull request #527.  This pull request has had some extraneous stuff weeded out, some pushed to other branches, bugs fixed, and (most important) a bunch of time spent in 'git merge -i' to its benefit.  But the discussion on that pull request is still background for this one.  I've fixed all the bugs I know of, the pull request is comprehensible now, and I think it's ready for Mosh.\r\n\r\nTo summarize what this does:\r\n\r\n* It improves the containers in Terminal::Framebuffer.  Terminal::Renditions and Terminal::Cells go on a diet (important when you have 30k of them), Cells use UTF-8 strings instead of vector<wchar_t> because std::string is faster everywhere I've tried it (even with different implementation strategies), and Rows are stored in vectors instead of deques (deques do neatly handle scrolling, but they are costly to index and construct/delete).  It also reworks some methods to allow slightly more efficient generation of the diff string.\r\n* It rips apart^W^Wrefactors Terminal::Display::new_frame() and put_cell() to use a put_row() instead, and carefully optimizes the per-character loop inside to be much more efficient, and more logically organizes the state necessary for tracking the generation of the diff string.  It also reworks character output to reduce the amount of characters generated significantly.  Another motivating piece for this was to make both Framebuffers passed into new_frame() const references, instead of having to copy one.  That in itself improved performance, but it lead to...\r\n* The last and largest improvement: making the Rows in Framebuffers shared, copy-on-write objects with the help of std::shared_ptr.  I knew something like this was possible, but scratched my head for a while on how to do it cleanly.  The change ends up being elegant and not very large, though-- thanks to past efforts to ensure const correctness everywhere else in Mosh.  This greatly reduces the amount of copying mosh has to do to maintain multiple terminal states (except for one case-- where you cat a large file to your terminal and it's scrolling as fast as it can).  This greatly improves Mosh's performance for actual use cases where not much of the display changes from frame to frame, like sitting idle or working in an editor.\r\n\r\nIt also has various little algorithmic improvements and fixes for pet peeves, but those are fairly straightforward stuff.\r\n\r\nI think the shared/COW Rows change also has potential to help with other long-standing feature requests and issues in Mosh, such as versioned prediction and scrollback buffering.  I haven't really explored that though."},"comment":{"url":"https://api.github.com/repos/mobile-shell/mosh/issues/comments/161474713","html_url":"https://github.com/mobile-shell/mosh/pull/531#issuecomment-161474713","issue_url":"https://api.github.com/repos/mobile-shell/mosh/issues/531","id":161474713,"user":{"login":"keithw","id":208955,"avatar_url":"https://avatars.githubusercontent.com/u/208955?v=3","gravatar_id":"","url":"https://api.github.com/users/keithw","html_url":"https://github.com/keithw","followers_url":"https://api.github.com/users/keithw/followers","following_url":"https://api.github.com/users/keithw/following{/other_user}","gists_url":"https://api.github.com/users/keithw/gists{/gist_id}","starred_url":"https://api.github.com/users/keithw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithw/subscriptions","organizations_url":"https://api.github.com/users/keithw/orgs","repos_url":"https://api.github.com/users/keithw/repos","events_url":"https://api.github.com/users/keithw/events{/privacy}","received_events_url":"https://api.github.com/users/keithw/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T00:20:50Z","updated_at":"2015-12-03T00:20:50Z","body":"Just rebased this on master and ran it through some tests. All lgtm. (In my view, the case of an app that prints tons and tons of combining characters to the same cell is now properly handled -- after the limit on cell size is reached, the server-side framebuffer stops changing, and the `mosh-server` stops sending any updates to the `mosh-client`)."}}