dylanjosh

Hello

So something we've been struggling with is figuring out which animations are "heavy" and are taking up too much frame time. I want something where we can visualise (or just dump in a log) the relevent performance stats during runtime. I know there's the metrics view in the editor, but is there anything during runtime?

If there's nothing currently, then could I get a couple of pointers in how to go about this? Calculating the frame time of the updateFrame method is one of the obvious one. I'm not too familiar with meshes, vertices etc so I'm thinking thats something I need to be profiling too. Where can i check those things?

I'm using LibGDX btw.

Thanks!
dylanjosh
  • Messaggi: 12

Nate

Some metrics are easier, like how many timelines an animation has. For others you would need to either edit the renderer, attachments, and other runtime code to collect metrics, or write code that does the same things but collects metrics instead of rendering. You could count how many attachments are drawn, how many deform keys are applied, and the other metrics shown in the metrics view. I would probably make a copy of the runtime and hack it up to collect metrics.

For example, most renderers have code like this:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java#L186-L197

In VertexAttachment computeWorldVertices you can count the vertex transforms. Minimizing that can be helpful for CPU usage (but only if that is your bottleneck).

Take special care with clipping, it can be very expensive, depending how it is used. The docs explain that:
Clipping attachments - Spine User Guide: Performance
Avatar utente
Nate

Nate
  • Messaggi: 12042


Torna a Runtimes