GPU Frame Time increased with 4.2

Hello all,

I recently updated the babylonJS version in my application from 4.0.3 to 4.2.1.

The performance (fps) decreased heavily. In the scene I am using for performance measurment my fps droped from ~40 to ~6.

I started some first analysis.

This is how my scene for performance measurement looks like:

The special thing about my scene is, that I use instances quite drastically. Most of the objects you see in the scene are instanced meshes.

Here are the screenshots from the inspector:





Here are some Screenshots from chrome dev tools recording:



As you can see by comparing the inspector screenshots, metric “GPU Frame time” increased drastically. I am not very sure how to tackle this issue.

Do you have any Idea?
I will be happy and grateful for any tips :slight_smile:

P.S. My intent for updating was actually to capitalize on “thin instances” to increase performance. But now I am not that sure about that.

I’m seeing that you have FAR more indices and faces in 4.2.1 :slight_smile:

Are you using the same source? Is it gltf?

I did not notice the faces and indexes, as the factor was close to 10. You definitively have a point here.

I do not use gtlf or similar. In this application it is possible to model a warehouse. All of the scene is build with pretty standard bababylonJS library. Most of the stuff starts with a box, a cylinder or a sphere. Most of the objects are instances.

What could increase the number of indexes & faces?

Thanks in advance.

Well this is complicated to say without a repro :frowning:

Are you using some of these API:

  • mesh.convertToFlatShadedMesh()
  • mesh.optimize()
  • CSG

I do not use any of those API.

I digged around. It seems that the mesh.createIntance() produces much more faces and indeces in 4.2.1.

I created a very simple playgorund (a sphere + instance). With 4.2.1 I get the double amount of vertices and faces :frowning_face:



Do you have any Idea how I could improve that?
I think this is at least partially the reason for the performance drain.

Best & Thanks in advance

Oh I see! We were not counting instance faces and indices in 4.1.

So this is it not the culprit:(

Can you repro your initial issue in the pg?

Also do you see the same issue with 5.0?

It would be really great to have a repro even if privately sent in DM to us so that we can address this before the release :slight_smile:

@Deltakosh & @sebavan:

I will give my best to reproduce the Issue in the Playground.

However it is not that simple as the application is quite large. There are different object types. Those are heavily parametrized. The specification comes from the backend. I will try to pinn point it down to one or multiple object types.

  • Do you have any tips what I should observe especially?
  • GPU Frame time increased strongly. Are indeces & faces the main driver of it or is there something else I could / should monitor?
  • Just to check: I would like to implement a comparable indeces & face counting routine.
    – Number of faces = Number of indeces / 3.
    – Number of indeces = mesh.getTotalIndices()

Thank you guys I realy appreciate your help.

Yes, I do have the same issue with 5.0

What I would do is taking a Spector.js snapshot with 4.1 and 4.2/5 and compare the results. That should be a good start to understand where the discrepancy comes from.

Yup as @Evgeni_Popov mentioned and if you could share the traces with us, we could have a look into them.

Hello all,

I didn’t manage to make any advances today, but I captured the scene in the identical position with capture.js. I will try to analyze the file, but boy it is a lot of data :slight_smile:

If someone whants to take a look here it goes:

They look weirdly identical :frowning: so it might be an issue in the shader, I ll try to check. The only potential diff would be powerPreference which is default on fast and high-performance on the slow one unintuitively.

Could you try in the 4.0 to init the engine with powerPreference: “high-performance” in the option and see if it becomes slow ? and share a capture ?

could you also try in 5.0 ?

Hello all,

the Preformance with BabylonJS 5 RC3 got to the level of 4.0.3. I am not sure if I was just to stupid to get the recent version of BabylonJS 5 before or something changed. Until now I was sure that I tried it with 5 RC2. However with BabylonJS 5 RC3 the framerate is now comparable to 4.0.3.

Setting powerPreference: ‘highPerformance’ didn’t change anything. However I captured it anyway.

I created new spector-captures and uploaded them again jointly. You will find here the following versions:

  • capture_403 (babylon version 4.0.3)
  • capture_421 (babylon version 4.2.1)
  • capture_401_highPerformance (babylon version 4.0.3 with powerPreference: ‘highPerformance’)
  • capture_5RC3 (babylon version 5 RC3)

I am actually happy with 5RC3 performance. I can wait until it goes stable.

I started porting one of the object types, which I suppose to cause the performance drain into the Playground with some hard coded parameters. I am interested into where it comes from. I suppose you would like to know it either, right?

Thak you again :slight_smile:



Glad to know it is all good again in 5 !!! :slight_smile: