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

Browser gets frozen when a command outputs too much data #81

Open
crevete opened this issue Aug 12, 2015 · 7 comments
Open

Browser gets frozen when a command outputs too much data #81

crevete opened this issue Aug 12, 2015 · 7 comments

Comments

@crevete
Copy link

crevete commented Aug 12, 2015

When we type a command that outputs too much (or unlimited) data, for example find /proc or yes, the browser (Firefox, even Chrome) will be very slow or gets frozen. This performance issue is due to the algorithm you use when rendering output on screen : you first write the entire data into a buffer and then you display it. This means : the data is read twice.

I know this is not quite simple, but I wonder is it possible to do better to get higher performance so that the browser will not get frozen at least.

@crevete
Copy link
Author

crevete commented Aug 19, 2015

Any input on this performance issue @chjj , thanks ?

@chjj
Copy link
Owner

chjj commented Aug 21, 2015

I've personally never run into this. I just tested it in my terminal (as a blessed widget, which could conceivably have even worse performance issues especially if the terminal is not full screen). I ran yes, find /, and cmatrix and noticed no performance issues. I'll have to test it in the browser.

I've tried to optimize the browser renderer a number of times in the past. I always ended up scrapping it due to its complexity and headaches. I've never heard of it actually freezing though (the freezing might be a different issue, it should never freeze completely just because it takes a while to render something).

@aurium
Copy link

aurium commented Aug 22, 2015

@chjj i also believe the bug is not related to data stream size. Wherever, if i get it right, term.js remove all child html elements from the terminal element and writes new ones for every update. That is surely not the best approach. :-) Did you think about to have one <span> for each screen position and update only the innerText with the right char and the style attribute with the local term style?

@crevete
Copy link
Author

crevete commented Aug 30, 2015

@aurium Personally I think it would be better.
@chjj Actually what I mean "frozen" is just like you said : it takes long time to render something, and that may give impression that the browser is frozen. And when it outputs, for example find /proc, and I hit Ctrl+Cto stop it, it may fail (It continues to output results). That's we have experienced after tens of tests.

@sagar-chandarana
Copy link

try 'yes blah'. it will freeze, at least it did for my whole team and customers. In my implementation, i managed to hack it with a buffer, and a rate of data bursts, so that browser has only a few things to render at a time. when the buffers got filled, i had to remove the characters yet to be sent, and that sometimes distorts things for graphic heavy apps

@crevete
Copy link
Author

crevete commented Oct 3, 2015

@sagarchandarana123 thanks to confirm this issue. Could you share your workaround source code ?

@sagar-chandarana
Copy link

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

No branches or pull requests

4 participants