Open Bug 1028893 Opened 10 years ago Updated 2 years ago

Firefox still janky for HTML5 games

Categories

(Core :: Graphics: Canvas2D, defect)

33 Branch
x86_64
Windows 8.1
defect

Tracking

()

People

(Reporter: ashley, Unassigned)

Details

(Keywords: perf)

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36

Steps to reproduce:

Visit the following URL which runs a performance test based on a real-world HTML5 game built with a real-world HTML5 game engine (Construct 2):
http://www.scirra.com/demos/c2/sbperftest/

The test measures the jank, calculated as deltatime - (1/60) every rAF. In other words a perfect 60 FPS will measure 0ms as jank, and 16ms jank means it skipped a frame (since the delta time between two rAF will have been 32ms).

It also measures approximately how many frames are dropped simply by the difference between the measured FPS and 60. E.g. if the FPS measures 57, it adds 3 to the dropped frames.

The Construct 2 engine has already been highly garbage-collection optimised with far-reaching object recycling as far as is practical in a language like Javascript.


Actual results:

On a high-end desktop (Core i5-2500 @ 3.3 GHz, GeForce GTX 660 graphics, Win8.1) running Firefox Nightly 33, the test measures something like:

~11 dropped frames over course of test
Max jank: 42ms (~3 consecutive dropped frames)


Expected results:

This is a very powerful desktop machine and it should have no problems at all running it perfectly. Expected test results:

0 dropped frames
Max jank: <5ms
Results from other browsers on same machine:

Chrome Canary 38: ~2 dropped frames, max jank 21.8ms

IE11: ~1 dropped frame, max jank: 3.8ms
Firefox for Android beta (v31) on a Nexus 5: ~65 dropped frames, max jank: 51.4ms
Keywords: perf
Component: Untriaged → Canvas: 2D
Product: Firefox → Core
Here is profile taken on win8.1 with 33.0a1 (2014-06-29).

  http://people.mozilla.org/~bgirard/cleopatra/#report=6c93b143687e86fb04fa94b3f3f159ed297af7e1

I see a 25ms composite around time 36894ms.  Seems its stuck flushing to the D3D?  Benoit, what do you think?

There's also an obscene 250ms+ jank at the start from nsOfflineCache, but I don't think that repeats during the test.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(bgirard)
Ashley, could you try getting a profile on your machine as well?  Instructions are here:

  https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler
Flags: needinfo?(ashley)
I don't know much about D3D. It's something that the driver is doing but it could be caused by us.
Flags: needinfo?(bgirard) → needinfo?(bas)
I'm not sure how to get useful data from the built-in profiler. It just has a straightforward breakdown of the time in Javascript execution. Where do I look for causes of jank?

In the corresponding bug report for Chrome, they identified the JS compiler as the cause of the jank: https://code.google.com/p/chromium/issues/detail?id=387675 - perhaps the cause is the same in Firefox?
Flags: needinfo?(ashley)
Is anyone looking in to this?
At the moment, this is still an issue, with firefox being the worst of the top 3 browsers(IE, Chrome, FF). Irony of ironies, IE has the least jank, beating Chrome and FF. This is more noticable with Construct 2 games than other applications given the complexity of the engine, but even simpler applications exhibit this quirk (see sunspider tests).
I come here for the same reason. While I use Firefox as my main browser for a long time now, I am forced to use Chrome for all my HTML5 tests made with Construct, because Firefox is simply so behind in terms of performance. It has major stuttering issues and audio problems like click&pops and insufficient looping support. The stuttering in particular is very annoying and in essence brakes the game. On my creations I am forced to put a link to the Chrome download page, prompting the users to play the games with Chrome. That's bad both for presentation and marketing purposes.
Note there's a pretty fruitful discussion in bug 1083418, which may well help this test as well.
Firefox 34 beta on Android (Nexus 5) still measures ~80 dropped frames, 55ms max bank. It regularly janks 30-40ms. It's dropping frames all over the place and doesn't seem to be getting any better.
Noting bug 1080869 may be related. Construct 2 users have noticed v-sync timing issues, there's a ~90 page thread on our forums about it: https://www.scirra.com/forum/about-the-jerkiness-on-the-movement_t117554
Tried Nightly 36.0a1 on a different system (laptop), measures 18 dropped frames and 32.7ms jank. Noting bug 1093454 may also be related.
I have no idea what could cause this, and I can't investigate right now unless this problems gets officially prioritized.
Flags: needinfo?(bas)
This is considerably improved on desktop with Nightly: using 37.0a1 it scores a pretty much perfect max jank of 2.2 ms and 0 dropped frames.

Firefox beta 35 for Android on a Nexus 9 is still very janky though, dropping ~50 frames and max jank of 59ms (!), but maybe the improvement is in v36 or v37?
Possibly related to Electrolysis landing in nightly?
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.