Open Bug 1256479 Opened 8 years ago Updated 2 years ago

Slow minor GCs for other tabs affect handwritten FPS (dim3)

Categories

(Core :: JavaScript: GC, defect, P5)

defect

Tracking

()

People

(Reporter: sfink, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: perf)

The performance of this game engine demo is awful in general in Firefox. On my machine, Firefox generally gets 4-10fps and Chrome is a pretty solid 40fps. One specific awfulness is that we're getting a REFRESH_FRAME minor GC every frame that takes ~50ms!

So something is going terribly wrong here.

(Brian Barnes: CC'ing you on this bug. The problem isn't that we are GC'ing; it's reasonable to do a minor GC every frame. But a minor GC should normally be under 1ms.)
Summary: Slow minor GCs on handwritten FPS → Slow minor GCs on handwritten FPS (dim3)
fitzgen reports 60fps. I tried in a new profile and got 40fps (and the load time matched Chrome too).

So it seems like my primary profile is the only place I get the awfulness.
I've never seen this on any the test I've done with it, so this is interesting.  I want to note that the content of the game is auto-generated and dynamic, so it might be hard to test as you'll get a new map, models, bitmaps, etc, every time you run it.  The only way to change this is to get the code from github, run it local, and look for this in constants.js:

const SEED_MAP_BITMAP=Math.trunc((Math.random()*SEED));
const SEED_MAP=Math.trunc((Math.random()*SEED));
const SEED_MODEL_BITMAP=Math.trunc((Math.random()*SEED));
const SEED_MODEL=Math.trunc((Math.random()*SEED));
const SEED_ENTITY=Math.trunc((Math.random()*SEED));
const SEED_SOUND=Math.trunc((Math.random()*SEED));

Change all those to some constant integer and it'll always generate the same assets.

The light mapping routines (a ray trace on every surface in the map) is a good terror test for optimizations, too.
In my main (slow) profile, I shut down some tabs that about:performance was complaining about, and am now getting 20-25fps, with ~30ms minor GCs. In my clean profile, I'm still getting 40fps. The slowest minor GC I found was 1.8ms; most are around 1.3ms. Also, I get long stretches of rAFs with no minorGCs (though they don't seem to be correlated with getting a higher framerate.) Those stretches are *much* longer in the fast profile, though that might be from the same frequency of minor GCs since it's getting a lot more frames in during the same length of time.

It kind of looks like my slow profile is getting lots of memory interference from other tabs, I guess. 30ms minor GCs is still really bad.
Keywords: perf
Summary: Slow minor GCs on handwritten FPS (dim3) → Slow minor GCs for other tabs affect handwritten FPS (dim3)
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.