Jump to content

StandardMaterial.isReady cost


JCPalmer
 Share

Recommended Posts

In my morphing using SIMD testing, i finally switched to using the profiler.  My measurements of deformation CPU are just not reliable.  The Firefox Nightly profiler is kind of messed up though.  I dropped back to my non-SIMD calls, and ran on FireFox 37 to get a base line.

 

Found that updating positions & normals was only 0.78% of total CPU used, anyway.  The split between evaluationMeshes & render was 32.85% & 55.76%, respectively.

 

What surprised me is 9.54% of the total cost was in StandardMaterial.isReady().

post-8492-0-49589500-1431627928_thumb.pn

Going to Babylon.Material, I see there is a way to avoid paying this tax foreverrrrrrrrrrrrrrrrrrrr.

public checkReadyOnEveryCall = true;public checkReadyOnlyOnce = false;

Unfortunately even if I switched all my materials to checkReadyOnlyOnce = true;, in the Babylon.StandardMaterial override of isReady(), where checkReadyOnlyOnce is taken into account is commented out :angry:.

 

DK, I realize I been a pain in the ass ever since finding out I could do profiling, but this just does not scale.  Amdahl's Law dictates that speed up is limited greatly by the amount of time spend doing things serially, i.e. javascript.  Would not mind, if it went away after a few frames.

 

Can that line can be un-commented?  With either grabbing textures that are already stored locally in the app, or in-lining textures right into source code for the web, this should be largely avoidable.

Link to comment
Share on other sites

There is a comment right after that too.

if (!this.checkReadyOnEveryCall) {    if (this._renderId === scene.getRenderId()) {       //  return true;    }}

FYI, does anyone even know this is here?  I only ask, since it is not the default.  Did a forum search on 'checkReadyOnlyOnce'.  This is the only topic found.

Link to comment
Share on other sites

Ok, now that the business end of checkReadyOnlyOnce is no longer commented out, I performed some comparison analysis.  First I re-did the base-line, that is defaulting to checkReadyOnlyOnce = false.  Also the scene had 28 materials, 2 textures.

 

For best repeatability, I am using a standard size for my window, half width that you get from dragging the title bar off the screen.  FYI, since performance metering cannot be turned on / off in code, it is very difficult to numbers from different runs real close.

post-8492-0-43178100-1431723207_thumb.pn

This run isReady is 7.2%.  After checkReadyOnlyOnce = true on all materials, a re-run drops isReady way down to 2.07%.  Of course now, everything else is a higher percentage.

post-8492-0-84027700-1431723584_thumb.pn

Wondering if having a static to set for all materials would be good.

Material {    public static CHECK_READY_ONLY_ONCE_FOR_ALL = false;}StandardMaterial{    public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean {        if (this.checkReadyOnlyOnce || Material.CHECK_READY_ONLY_ONCE_FOR_ALL) {            if (this._wasPreviouslyReady) {                return true;            }        }        ...    }}
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...