BlackMojito

About performance optimization

Recommended Posts

I have two questions.

1. On the first screenshot, why do I have such enormous "idle" time? It seems that it is even longer than the "render" function itself. How can I improve that?

2. On the second screenshot, it seems that PBRBaseMaterial is too much time-consuming. How can I reduce that? Is this time related to frequent shader program switch?

2.jpg

Developer Tools - httplocalhost8081index.htmlprojectId=2c9180825f89ebd3015fb9afb99e02ff&documentId=eedb2c5a53cd4eaf967ccf894b94266.jpg

Share this post


Link to post
Share on other sites

1. because the engine loop calls rendering on requestAnimationFrame, so it's synced to a 60Hz monitor. So its a good thing, the rendering is faster than needed. Try it on a slower machine or add some few hundred meshes and physics, you quickly run out of that idle time ;)
2. This looks really fast to me, the graph is 0.7ms from left to right... at 60Hz you have 16.777ms for every frame, so it's nice.

You will only now what to optimize when you got a really high load.
I try to test everything on my 3yrs old PC with GTX970 and i7 4790K, and my 6yrs old PC with Radeon 7970 and Phenom II X6 1090T. So older and older machines, new and old phones etc.

 

 

Share this post


Link to post
Share on other sites

I found one thing we might be able to optimize.

In PBRBaseMaterial.bindForSubMesh(), we do this._afterBind(mesh); while in StandardMaterial.bindForSubMesh(), we do this._afterBind(mesh, this._activeEffect); The active effect is actually never cached for PBR materials.

So for PBR materials, 

var mustRebind = this._mustRebind(scene, effect, mesh.visibility);

returns always false. Which leads to wasting a lot of time on rebinding stuff...

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

  • Recently Browsing   0 members

    No registered users viewing this page.