Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CurvyConnection Update Overhead
#1
Hi there,

We're noticing some pretty significant performance overheads from CurvyConnections. It looks like regardless of the auto create or auto enable/disable settings on the pools, we have about 1000 CurvyConnections getting spawned on startup for pool usage. Each of these seems to be running Update, FixedUpdate, LateUpdate and EditorUpdate (the last only in Editor obviously).

Our performance hit from this is not insubstantial. Below is a sample DeepProfile:

null

Keep in mind Curvy splines exist in the scene, but are completely unused at this point. No transforms are being changed and no spline methods are being called. I have checktransform off on all splines, but the connections seem to be completely separate and I haven't found any settings that can successfully optimize them. ^ The above deep profile is also only showing the FixedUpdate, but the Late and regular Updates shouldn't be forgotten.

Can anybody give some advice on what we can do to lessen this performance impact?
Reply
#2
Hi
It seems that the sample you attached is null. Can you try attach it again, or if the problem persists, send it to me via email? My email is listed here: https://assetstore.unity.com/publishers/304
So if I understand correctly, you have a pool with 1000 connections, and that number is not the expected number. What is the number of connections you are trying to have on the pool? Can you explain to me how you intend to use those pooled connections?
Also, if you have a reproduction case you can share, please do so, that would help.
I guess that you are using the latest update of Curvy Splines, is my guess correct?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Yes, that's correct, we're using the latest version of Curvy. I'm actually not sure how many Connections we need at runtime since our curves are all static. I can't find a way to make the pool smaller or limit the overhead of each in any curvy settings.

Apologies for the null attachment, it was a profiler image. I'll attach it here as a proper attachment instead of dragging it into the post.


Attached Files Thumbnail(s)
   
Reply
#4
I will take a deep look at all this later today. Until then, know that in the pool script, there is a Threshold parameter that defines the maximum number of elements to keep. If this didn't help, is it possible for you to send a reproduction case (scene and the scripts needed by that scene) with the issue?

In general, I don't recommend to use the pool components such as ComponentPool, which are part of the FluffyUnderware.DevTools third party library. They do the work, but they are not intuitive to use in my opinion. I am sure there are way better pools from pooling assets on the store. Curvy Splines uses the pools from DevTools for historical reasons, but for new code such as yours, I would avoid using them.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
(10-06-2021, 07:34 AM)_Aka_ Wrote: I will take a deep look at all this later today. Until then, know that in the pool script, there is a Threshold parameter that defines the maximum number of elements to keep. If this didn't help, is it possible for you to send a reproduction case (scene and the scripts needed by that scene) with the issue?

In general, I don't recommend to use the pool components such as ComponentPool, which are part of the FluffyUnderware.DevTools third party library. They do the work, but they are not intuitive to use in my opinion. I am sure there are way better pools from pooling assets on the store. Curvy Splines uses the pools from DevTools for historical reasons, but for new code such as yours, I would avoid using them.

I'll try playing with the Threshold, thanks. We aren't using the Pool components at all, I'm just seeing that the CurvyGlobal object is utilizing them and was trying to change the parameters there. We have our own custom ObjectPooler for our own purposes.
Reply
#6
(10-07-2021, 05:13 PM)wingednosering Wrote: We aren't using the Pool components at all


This is weird, there is something that I seem to be missing: How did you end up with a components pool containing connections (CurvyConnection class)? Curvy Splines do use components pools for some components, but CurvyConnection is not one of them. Can you send me a scene so I can see what's going on? Otherwise, just delete that pool of connections, and see if it gets recreated, and hopefully pinpointing what exactly does create that pool.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
(10-07-2021, 05:53 PM)_Aka_ Wrote:
(10-07-2021, 05:13 PM)wingednosering Wrote: We aren't using the Pool components at all


This is weird, there is something that I seem to be missing: How did you end up with a components pool containing connections (CurvyConnection class)? Curvy Splines do use components pools for some components, but CurvyConnection is not one of them. Can you send me a scene so I can see what's going on? Otherwise, just delete that pool of connections, and see if it gets recreated, and hopefully pinpointing what exactly does create that pool.

Unfortunately, I can't send the scene as this is under strict NDA. Here is a screenshot of our autogenerated CurvyGlobal object's inspector. We've deleted all the CurvyConnection children, but as soon as we enter play mode 1000 more are spawned as children of the CurvyGlobal GameObject. I've tried adjusting the threshold and it still seems to spawn 1000 no matter what.

We only recently updated to the latest Curvy (we were having this problem in an older version and hoped the upgrade would fix it) so this is a fresh Curvy install with nothing altered.


Attached Files Thumbnail(s)
   
Reply
#8
1- In the screenshots, it is not connections that are in the pool, but control points (a.k.a CurvySplineSegement). Do you see any pool with CurvyConnections in it? If the answer is no as I expect, then the issue might not be tied to pools.

2- Do you create any spline, or other objects using Curvy's API? Or are the created Curvy objects created via the editor?

3- I understand about the NDA, but maybe you can isolate the issue in a simple scene with no proprietary assets, and if needed mockup code that does what is needed to reproduce the issue.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#9
My answer above is part of me trying to understand how you got 10k connection in your scene, which is in my opinion the right step to solve this issue.
Another solution, which I like less but that you might prefer, would be to accept that 10k connections are in the scene, and make them not use the CPU. Since you said you are not using the connections, you can go to CurvyConnection.cs, and remove/comment the code of Update/LateUpdate/FixedUpdate.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#10
Thanks for the information. Knowing it wasn't a part of Curvy natively helped us find it. It looks like at some point one of our scenes was saved with these underneath CurvyGlobal. When that scene was additively loaded, the CurvyGlobal children merged, making our final CurvyGlobals connection count huge and giving the appearance of them being spawned when entering play mode.

Removing them from the saved scenes helped. If CurvyConnections are designed to be temporary (not sure if they are) they probably shouldn't be savable. Either way, this was our bad.

Thanks again for your prompt responses!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling Update with defined deltatime Marco Schultz 3 8 01-25-2023, 01:58 PM
Last Post: _Aka_
  I want SetLocalPositions to update all CPs at once. yanke 3 7 05-30-2022, 02:50 PM
Last Post: _Aka_
  Update - Which folder to delete Marco Schultz 3 8 04-26-2022, 05:00 PM
Last Post: _Aka_
  Lots of Allocs in Editor Update (Poor Performance in Editor) TdayMFG 4 3,151 02-06-2020, 10:13 PM
Last Post: _Aka_

Forum Jump: