Weird spikes in web profiler

I have no sound running whatsoever. Still I have a gameobject with a few soundcomponents.
Looking in the webprofiler trying to catch weird fps spikes I see that the Sound.update is constantly lying on 2 ms and spike at 6-7 ms.
This is on iPad mini 2 (A1490)
Why is that?

Edit: forgot the screen:

2 Likes

Seems like using collection proxies does a bigger impact on performance than I previously thought. I will try to “bake” a few of them to see if also sound will be more performant. Still those spikes are really weird

2 Likes

Yes, that’s strange. We had a performance problem a while back when sounds were muted but playing. In this case no sound component is played right?

1 Like

Correct. Double checked.

As the documentation about profiler is kinda limited and I am not really sure exactly what the different tags are I will make this thread more open for all kinds of spikes, because they are occuring at very weird places and blocking the frames :frowning:

Here I get this input spike every now and then (lasting half a frame):

Also this one is really hard and I’m not sure what Resource loading is (no loading whatsoever is taking place in core game play). Is it something that has to do with collectionfactory creation? +60 ms !!!

I really would like to know more about why this is happening. Feels like I’m chasing ghosts in the profiler right now.

1 Like

I just leave it here GO and performance (Bug or not?)(SOLVED)
It maybe a something similar.

While at it: could someone explain why vsync spikes ~32ms sometimes when the whole Engine.sim takes 9ms? (60 fps target)

2 Likes

These are all really right questions!
I adding my vote to every of your post in this topic (I had the same questions on this week!)

1 Like
  1. GameObject.DispatchInput.
    This will call on_input in active scripts. Have you checked if there’s anything in those callbacks that could consume this sort of time?

  2. Resource.Get
    Resource.Get is called when a resource of any type is created. A collection is a resource and if you create a collection with a collection factory it will create all objects and (sub) components it contains. ~60ms a lot though, but I can’t say more without looking at the resource setup…

@AGulev Your case is having 10000 active gameobjects needing a transform and not a cpu-spike scenario (feel free to correct me if I’m wrong).

It would be super cool to have a small note like that for every entry in the web profiler documentation :slight_smile:

1 Like

32ms spike: It seems to me the GPU frame takes > 16 ms in which case it will need to wait to next VSync, which is at 32ms counting from 0. The frame time is max(gpu_time, cpu_time).

Thanks Andreas!

DispatchInput: I will double check as I do have 2-3 entrypoints for on_input()

Resource.Get : I have instances being created all the time. This happens very randomly and seems to go back to that single factory with one sprite and one script. Its hard to replicate. I might pop by the office and give you a look if you are there this week as I really don’t think it is a big creation.

32ms spike: So none of the Render tags in the profiler has anything to do with gpu? (Renderscript.UpdateRSI)

Great. I’m here all week. Leaving around 2.45pm on Thursdays.
We can have a look at the Resource.Get etc then.
The profiler does not measure GPU time in any sense, except for the VSync which of course is related since that’s the one (potential) sync-point to the GPU processing. The Render tags are how much CPU-time is spent to set up the rendering frame and subsequent OpenGL calls (which are in most cases non-blocking).

1 Like

Sorry, you are fully right.
It was a part of my big investigation on the last week, and in my head it was a part of the same. Sorry for that.

But I found the same strange spikes when profiling empty project (just one empty collection) on ipad4 for ex. show strange 1ms for sounds or 2+ms for Engine.Sim

I just tried to compare results for different engine entities and find a way for optimisation a really big project.

I agree with @Mattias_Hedberg, would be great to have documentation about the every entry in the profile.

1 Like

Is this something that depends on the hardware it is running on? Like iOS having some kind of strange audio driver problem?

On desktop I always get times like for Sound.Update 0.03

It does seem there is at least something odd going on with sound here.
When there’s no sound playing there should not be any overhead at all!

Added a ticket: DEF-2856. Audio CPU processing when no audio is being processed

2 Likes

This profiling screenshot was made from fully empty project running on ipad4:

UPD: and I still didn’t understand why I can see in profiling collisions, dispatching messages and so on…

1 Like

What? Do you get numbers for “Messages” and “collisionobjectc” in the web profiler when running an empty project?

Ok. One more time in one post.
I am building empty project (I have input binding file with click and multi-tocuh, but have no scripts at all, and have no objects):

(project contain some other things from old tests but they didn’t used in main collection)
test.zip (249.6 KB)

Installed this ipa to my iPad 4, and check using web profiler (in this time i tap to screen, i don’t know maybe it doesn’t matter… i just tried to understand why in main project i have serious fps drop when when tap to the screen):

Sometimes I afraid to post all my investigations, because my activity on forum can looks toxic.

6 Likes