TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

Games in Firefox slow down. (if you do not move the mouse intensively)

Open Ratinod opened this issue 3 years ago • 15 comments

OS: Windows 10 Firefox: 85.0.2 (x64)

example: https://tic80.com/play?cart=115

Don't move the mouse cursor: https://user-images.githubusercontent.com/12137233/107885422-523d3b00-6f0b-11eb-9389-1437cf513df6.mp4 Move the mouse cursor, then stop: https://user-images.githubusercontent.com/12137233/107885485-a9431000-6f0b-11eb-9bcf-c372b3595437.mp4

Ratinod avatar Feb 14 '21 18:02 Ratinod

It's running okay for me. An older version of Firefox, and an older laptop. It sounds like a limitation on the CPU? What hardware are you on? Try Chrome instead, I've seen differences in the ways they run WASM.

RobLoach avatar Feb 14 '21 19:02 RobLoach

If it was a CPU limitation, then there would be problems in other browsers, right? But in other browsers everything is fine (the problem appears specifically in firefox). And if you move the mouse, then there is no slowdown. CPU: I7-4770k

Ratinod avatar Feb 14 '21 20:02 Ratinod

Firefox's implementation of web assembly is somewhat different than Chrome's implementation. There isn't much that we can do in TIC-80 to help that.

RobLoach avatar Feb 14 '21 20:02 RobLoach

CPU: I7-4770k

@RobLoach That's no slouch of a CPU. It's quite possible it's indeed a Firefox issue, but I'm not sure it's a CPU issue - since as stated it works normally if the mouse is moved... Sadly I have no idea what to suggest though.

joshgoebel avatar Feb 14 '21 20:02 joshgoebel

after run cart firefox: total cpu usage ~7% total gpu usage ~ 20% opera: total cpu usage ~7% total gpu usage ~ 10%

firefox: when launched in multiple tabs, slows down in all tabs (no worse than it was) opera: when launched in multiple tabs, works well

Update: Achieved even more dramatic slowdown in the browser:

  1. Open firefox
  2. Open https://tic80.com/play?cart=115
  3. Open https://tic80.com/play?cart=115 in the second tab. Result: (sound from the first tab is muted) https://user-images.githubusercontent.com/12137233/107926929-6161ce80-6f87-11eb-9fe8-c8308a743107.mp4 Mouse movements also give some positive effect, but overall even worse than in the first tab.
  4. Then I closed the first tab. Nothing changed.

Ratinod avatar Feb 14 '21 21:02 Ratinod

This sounds like perhaps a Firefox problem more than a TIC-80 problem... can we reproduce this now in 2022 with the latest builds of TIC-80 and Firefox?

joshgoebel avatar Jan 25 '22 01:01 joshgoebel

I confirm. The problem is reproduced with the latest builds of TIC-80 and Firefox.

Ratinod avatar Jan 25 '22 11:01 Ratinod

I'm also seeing slowdown issues in my own game (link) when viewing it in Firefox. I'm using Firefox 113.0.2 (Windows 11).

I am using pairs(...) and closures in a few places. But, I experimentally got rid of those and the game still crawls :(

I did find something interesting though. I intended to open Firefox's Inspector and do some profiling, but, weirdly enough, my game runs perfectly when Firefox is recording a profile. ???

Then when I stop recording a profile, the game slows to a crawl again. I really have no idea what's going on.

ChillyCider avatar May 30 '23 23:05 ChillyCider

I won the game! Played on Firefox 113.0.2 (64-bit) Linux, didn't experience any slowdown. Fun game! Brought me back to playing Lemmings as a kid.

RobLoach avatar May 31 '23 15:05 RobLoach