Sign in to follow this  
ParadoxMaster

FPS drops in Firefox with Cycle Collection

Recommended Posts

When I run my game in Firefox, after a few minutes of gaming or even just rotating the camera, the FPS in the game starts periodically drops. Of the stable 60 FPS drops by about a couple of seconds to 20-30 or even just stops. And it starts to happen more and more often. To fix this i need to reboot the browser, nothing else helps. I researched in the performance devtools in the browser and found that this is due by "Cycle Collection" process.

( Note: when I start recording performance, all FPS drops disappear, as if I restarted the browser. And I have to wait again for a while before they start. )

Has anyone else experienced this issue? What could it be? Another Firefox's WebGL bug? In Chrome and Edge i have no problems.

screenshot1.JPG

Share this post


Link to post
Share on other sites

Looks like you are instanciating items during the render loop adding pressure to the GC.

Basically all the code in your render loop should not contain new keyword (of course a new happening every 10 seconds during a special event might be ok as long as it is not instanciating a big chunck of data)

 

Share this post


Link to post
Share on other sites

Thanks for your replies! It's strange, but I can't reproduce this situation anymore...  Without any significant changes in the code.

I will describe in more detail what is happening in my code if it appears again.

About my render loop: i use it for the vector calculations for moving my characters. Like this:

move(deltaTime) {

        let ratio = deltaTime * this.FPS / 1000;
        let alignedEps = this.epsVector.scale(ratio * SPEED);
        let nextPosition = this._mesh.position.add(alignedEps);
        let nextNormale = this.targetPos.subtract(nextPosition).normalize();
        if (Math.sign(nextNormale.x) != Math.sign(this.normale.x) &&
            Math.sign(nextNormale.y) != Math.sign(this.normale.y) &&
            Math.sign(nextNormale.z) != Math.sign(this.normale.z)
        ) {

            // Stop walking;
            if (this._walkPath.length == 0) {

                this._needMove = false;
                this.targetPos = this._mesh.position;
                this.blendAnim(this.walkAnim, this.idleAnim, BLEND_TIME.WalkToIdle);

            } else {

                this._calculate();

            }

        } else {

            this._mesh.position = nextPosition;

        }

    }

It's okay? Or may cause this problem?

UPD: Now looking at it, I have guesses that a whole bunch of temporary vectors are being allocated here ...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.