Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: ben on September 28, 2017, 03:44:30 AM

Title: PlaymerFSM.OnAfterDeserialize performances issues
Post by: ben on September 28, 2017, 03:44:30 AM
Hello,

I have an performance issue when instantiating objects with PlaymakerFSM component on it. Even simple FSM make a huge spike on CPU (something like 0.75 ms per FSM on PC, more like 1.5 ms on consoles...).
In the profiler the problem seems to come from "PlaymerFSM.OnAfterDeserialize".

The problem is the code is in playmaker dll, so I can't find what's wrong.
Is there any way to optimize that, remove it?

(https://ibb.co/bJNUJk)

Thank in advance.
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: Alex Chouls on September 28, 2017, 06:50:21 PM
Hi, can you submit a bug report so we can get more system info (Unity version, Playmaker version etc.) We can then use the bug report to go back and forth a bit and figure out the problem (what you're describing sounds unusual).
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: jeanfabre on September 29, 2017, 02:40:42 AM
Hi,

 Do you have FsmObject variables or FsmArrays  with lots of content on these objects?

Can you make screenshots of the profiler? is it not an issue with an action on the fsm? or maybe you are running a loop of some sorts?


 Bye,

 Jean

Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: ben on September 29, 2017, 04:21:16 AM
Hi,

When I try to submit a bug report there is this error : "Error Submitting Report : Cannot connect to destination host."

My Unity version : 2017.1.f1 , playmaker : 1.8.5.f8

Here is an exemple of an object with 2 FSM with 10 events, 10 variables (except global ones), 10 states, where the spike occur. Here is a screenshot of the profiler :
(https://preview.ibb.co/jJVLQb/playmaker_Perfs2.png) (https://ibb.co/i1Midw)

The problem is just during the instantiate, not during the loop. It occur with differents FSM with differents actions. The Actions contains some FSMArray or FSMgameobject but all in variable mode, so empty at start.



Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: ben on October 02, 2017, 10:37:09 AM
Is there a way to access Playmaker code to know where the problem exactly is?
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: jeanfabre on October 23, 2017, 02:52:18 AM
Hi,

 PlayMaker core is not open source, but I think you should join the beta group ( I'll touch on this with Alex meanwhile). Would you be interested? As for the bug report, yes, good catch 2017.1 has issues, it works on 2017.2 maybe it's the same issue I had with Ecosystem, where the www class is broken. I have raised a ticket on this internally.

Instantiation of Fsm Component is known to be the performance sensitive part of PlayMaker because of the custom serialization system that has to be in place for PlayMaker to be visual. So this kind of reports do help a lot. I Also contacted Alex on this so that he can have a close look.

Thanks for your help :)

 Bye,

 Jean

 Bye,

 Jean
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: allornothing on May 06, 2018, 12:20:31 PM
Did anything happen with this? We're seeing some very poor performance on PlaymakerFSM.OnAfterDeserialize() (25kb / up to 4.2ms per entry) and it's killing our scene streaming.

Using Unity   2017.2.0p4  and Playmaker 1.8.5

Thanks
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: jeanfabre on May 07, 2018, 02:50:04 AM
Hi,

Are you part of the beta? If no and you would like to, let me know.

Typically, in this kind of cases, a repro scene will help, maybe this prefab has an fsm that uses some Unity object class and it makes it a lot slower to work with or maybe sounds.

 but yeah, if you could explain in more details what this prefab is, it would help.

Bye,

 Jean
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: allornothing on May 07, 2018, 05:50:37 AM
Hey - not part of the beta no, but would be happy to. We're a little over halfway through a large console project, so depends how safely we can make the switch and still use in active development?

We have quite a lot of FSMs, with a wide mix of variables and complexities. The profiler won't let me target individual instances, but I would possibly say it could be every FSM in the scene that's just been loaded that is firing it off.
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: allornothing on May 08, 2018, 12:21:14 PM
Hi Jean

Just a little bump :)
Title: Re: PlaymerFSM.OnAfterDeserialize performances issues
Post by: jeanfabre on May 09, 2018, 03:46:05 AM
Hi,

 To be part of the beta, you;ll need to pm me with a gmail address, we'll add you to the group.

serialization is dependant on what you serialize, so in order to be able to do anything here, we need a repro or more information. in your case, since it's linked to prefab youc an create a dummy scene that will load up each prefab one at a time, and then you can check which one takes the most perfs out and then check what data is in its fsms. and cut them down  until you find which ones are most impacting, this will help a great deal to know exactly what's going on and take appropriate steps.

 also, it goes without saying,but you should be using a pool manager, if you do, are you sure it's setup properly, this should improve this kind of performance impact by having already instancitiated a set of prefabs in the pool before it actually starts running.

 Bye,

 Jean