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

Firefox CPU usage skyrockets unlike non-WebGL web pages #67

Closed
meglio opened this issue Dec 17, 2020 · 13 comments
Closed

Firefox CPU usage skyrockets unlike non-WebGL web pages #67

meglio opened this issue Dec 17, 2020 · 13 comments
Labels
bug Something is broken help wanted Extra attention is needed web Related to running Egui on the web

Comments

@meglio
Copy link

meglio commented Dec 17, 2020

I have been exploring the Immediate Mode GUI concept, and I found a few demos for web applications, including emilk/egui.

One thing I noticed is that the CPU usage by Firefox skyrockets when I play with those demos, unliked with any other pages written with using HTML/CSS/JavaScript.

Q1. Why it happens and is this expected?
Q2. What happens if most of the websites I open in 50+ tabs use the Immediate Mode GUI - will Firefox and OS struggle?

Any input appreciated.

Many thanks,
Anton

@emilk emilk added bug Something is broken web Related to running Egui on the web labels Dec 17, 2020
@emilk
Copy link
Owner

emilk commented Dec 17, 2020

Hi!

No, this is quite unexpected! I have no problems in my version of Firefox running on my Mac.

What platform are you on? Laptop/desktop? What graphics card?

Does it still happen if you scale down the browser window?

What does the ms / frame read (left hand side on https://emilk.github.io/egui/)?

@meglio
Copy link
Author

meglio commented Dec 17, 2020

  • Mac OS Big Sur 11.0.1 (20B50)
  • Firefox 83.0 (64-bit)
  • MacBook Pro late 2015
  • CPU goes quiet ~30 seconds after I switch to another tab.
  • ms / frame is always smaller than 5ms
  • looks like sizing the window down helps a bit, but it's difficult to measure

Graphics card:
image

@emilk
Copy link
Owner

emilk commented Dec 17, 2020

Sounds like a GPU-side problem then. My WebGL skills are not great, and I don't really have the time to investigate this right now. There should theoretically be no problem at all with the GPU rendering, but WebGL is weird and maybe there is some subtlety when using large canvases.

That it is your CPU that spikes seems to indicate that FireFox is rendering on the CPU instead of the GPU, which is weird.

If anyone is good at web tools and diving into why large canvases + WebGL is sometimes so slow, that would be greatly appreciated.

@emilk emilk added the help wanted Extra attention is needed label Dec 17, 2020
@ghost
Copy link

ghost commented Dec 17, 2020

Well, at least confirm, please, that there is no bitcoin miner in your code :)

@meglio
Copy link
Author

meglio commented Dec 17, 2020

Re WebGL, I'm not that experienced to dig into it, but for sure desktop games run just fine on this Desktop, like e.g. Witness.

@emilk
Copy link
Owner

emilk commented Dec 17, 2020

@meglio you can also clone this repo and run cargo run --release -p demo_glium and verify that the exact same Egui demo runs fast when native (as I and epxect it will).

@meglio
Copy link
Author

meglio commented Dec 17, 2020

Same issue with the Hobogo game at https://emilk.github.io/hobogo/index.html

@dneumair
Copy link

Hi @meglio,
be sure, that you have hardware acceleration in firefox enabled... At least on windows it is possible to turn it off

@emilk
Copy link
Owner

emilk commented Dec 20, 2020

I've implemented a max-width in egui_web now: https://emilk.github.io/egui - does that help @meglio ?

@emilk emilk changed the title Firefox CPU usage skyrockets unlike with other non-Immediate-Mode (html/css/js) web pages Firefox CPU usage skyrockets unlike non-WebGL web pages Jan 3, 2021
@emilk
Copy link
Owner

emilk commented Jan 26, 2021

Thanks to @not-fl3 I now know this is a bug in Firefox: https://twitter.com/fedor_games/status/1342838418343141381 https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0

@emilk emilk closed this as completed Jan 26, 2021
@meglio
Copy link
Author

meglio commented Mar 12, 2021

So, let's look at it this way: there is a bug in Firefox that has been there for years, and is still making it impossible to use egui in the browser (one of the major browsers). Kind of being unfortunately ala vendor-locked.

@emilk
Copy link
Owner

emilk commented Mar 12, 2021

I definitely wouldn’t say it is impossible to use egui in Firefox. It just hurts the FPS and adds cpu usage, but it still works pretty well

@meglio
Copy link
Author

meglio commented Mar 13, 2021

When I tested it, it did not work pretty well, unfortunately :( Adding CPU usage that much just makes it not a viable option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken help wanted Extra attention is needed web Related to running Egui on the web
Projects
None yet
Development

No branches or pull requests

3 participants