Jump to content

FPS drops in Firefox with Cycle Collection


ParadoxMaster
 Share

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

Link to comment
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)

 

Link to comment
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 ...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...