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

Loading of data is extremely slow in web on Chrome #963

Closed
Tracked by #1206 ...
jleibs opened this issue Jan 27, 2023 · 4 comments · Fixed by #1977
Closed
Tracked by #1206 ...

Loading of data is extremely slow in web on Chrome #963

jleibs opened this issue Jan 27, 2023 · 4 comments · Fixed by #1977
Assignees
Labels
🪳 bug Something isn't working 🕸️ web regarding running the viewer in a browser 🪟 windows Problems specific to the Windows OS

Comments

@jleibs
Copy link
Member

jleibs commented Jan 27, 2023

Repro is relatively straight forward with even simple demos like car demo.

Happens on both chrome and edge browsers, but not on firefox.

Symptom is that new messages arrive at a rate of 2/sec.

You can see this happening in the profile view in chrome:
image
image

I don't know enough about the web task worker model to understand why these get scheduled so infrequently or why the task waits for ~15 ms before starting the deserialization function.

@jleibs jleibs added 🪳 bug Something isn't working 🕸️ web regarding running the viewer in a browser labels Jan 27, 2023
@emilk emilk added the 🪟 windows Problems specific to the Windows OS label Feb 11, 2023
@emilk
Copy link
Member

emilk commented Mar 17, 2023

What Jeremy has found is that the render task starves the websocket task.

A potential fix is to replace egui_ctx.request_repaint with egui_ctx.request_repaint_after(10ms) when there are messages to process.

@jleibs jleibs changed the title Loading of data is extremely slow in web on windows Loading of data is extremely slow in web on Chrome Mar 17, 2023
@jleibs
Copy link
Member Author

jleibs commented Mar 17, 2023

The call to repaint from within the websocket decode_log_msg handler seems to be part of the problem. As suggested, request_repaint_after dramatically improves the performance. However, this is somewhat broken on web and can leave us in a situation where the next render never happens (#1607)

@jleibs
Copy link
Member Author

jleibs commented Mar 17, 2023

An additional unfortunate finding is that the google-chrome profiler itself further exacerbates the issue.

@teh-cmc
Copy link
Member

teh-cmc commented Apr 18, 2023

Would be nice to redo these measurements when #1880 lands

emilk added a commit that referenced this issue Apr 26, 2023
Give the task that decodes incoming log messages a bit of time
before calling `requestAnimationFrame`.

Closes #963

Should improve web performance on Chrome and Edge
emilk added a commit that referenced this issue Apr 26, 2023
Give the task that decodes incoming log messages a bit of time
before calling `requestAnimationFrame`.

Closes #963

Should improve web performance on Chrome and Edge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 🕸️ web regarding running the viewer in a browser 🪟 windows Problems specific to the Windows OS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants