Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve refresh queue #438

Merged
merged 2 commits into from Jan 9, 2017
Merged

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented Dec 31, 2016

Use requestAnimationFrame in addition to a queue to refresh every animation
frame but only when a refresh is needed.

Fixes #280


This change results in a slight degredation in performance in terms of raw numbers but improves by being far more responsive by losing minimal frames and not locking up the web page while processing the output. requestAnimationFrame will only fire once the callback has completed so it will drop frames when necessary.

Below tests were running ls -lR /usr/lib, notice the increased rendering, paint and scripting time on the after timeline.

Before:

image

After:

image

@Tyriar Tyriar added this to the 2.3.0 milestone Dec 31, 2016
@Tyriar Tyriar self-assigned this Dec 31, 2016
@Tyriar Tyriar requested a review from parisk December 31, 2016 22:12
Use requestAnimationFrame in addition to a queue to refresh every animation
frame but only when a refresh is needed.

Fixes xtermjs#280
Fixes xtermjs#290
This allows the refresh public API to still function
@jerch
Copy link
Member

jerch commented Jan 1, 2017

Yeah the frame updates happen more often, making it feeling snappier (for the price of some more paints). IMHO this can only be improved any further by separating the websocket communication and terminal handling into a separate thread. See #150 (comment) and #150 (comment) for a comparison on my local computer with webworker. The second one with the webworker basically removes the websocket time (grey in the pie) and the terminal status updates (most of the yellow scripting time) from the main thread and adds some smaller scripting time for syncing between the threads. (Well it was based on the old code from July, might not work anymore with the new changes).

Copy link
Contributor

@parisk parisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing. 👏 👏 👏

@Tyriar Tyriar merged commit 28b38dc into xtermjs:master Jan 9, 2017
@Tyriar Tyriar deleted the 280_improve_refresh_queue branch January 9, 2017 00:24
@Tyriar Tyriar modified the milestone: 2.3.0 Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants