-
Notifications
You must be signed in to change notification settings - Fork 186
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
[BUG] High CPU load #168
Comments
Hey, thanks for the detailed report 🙇 Can you try and comment these lines from your event handler and confirm that it's still struggling : publish(x_field, y_advancer);
setTimeout(function () {
publishImmediately2 = true;
}, 50); I can't tell what's happening in the Anyway, removed the |
I think it comes from the "end" event listener. If I output console log on the end event, I get hundreds of log messages and further processing is blocked until all these events are handled. I removed all the other functions to test.
I'm still wondering if there is something limiting the |
I've experienced something similar where the joystick freezes, and I don't think it was my event handler taking too long - it occurred when my game was running at very low fps Nipplejs is very good in terms of feature-set but upon profiling it seems there are other performance issues - e.g. taking 2-3ms because of what seems like reading a dom style after writing to the dom (forcing the browser to re-render) |
Super good suggestion. Back in the days I wanted to have full browser support and it was easier this way. But I guess now, translate are way more supported than before. If you feel up to the task @MCArth you can submit a PR for it. |
Describe the bug
I'm having a very high CPU load when moving the joystick around. On a high level CPU, this works fine, but in my customer's browsers, the website starts to freeze. The joystick gets stuck for some seconds, other indicators updated over a websocket have a delay of several seconds. I can also simulate it by using CPU throttling when collecting Performance metrics in Chrome.
I first figured out that my event handler function just takes too long. Therefore, I set a timeout and removed
innerHTML
functions. This already resulted in a much better performance on my CPU. However, I'm still having freezes on lower power CPUs.How does
manager.on()
work if an event listener function takes too long to execute? Are the events just queuing up or are the same event listeners processed asynchronously? I assume the event trigger is much faster than my event listener function. How is this taken into account? Is there some measure if the events in the queue have a large time offset?My computations in the joystick event handler are not very complex (see below).
To Reproduce
Steps to reproduce the behavior:
I can't share the website or the source code. However, here's my joystick event listener:
In addition, there are some indicators and an image stream on the website, which are updated over a websocket.
Expected behavior
No freezes of joystick, no delay in image stream or other elements on the website, no browser crashes, real-time control.
Screenshots, Codepen or JSFiddle
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: