+1
Fixed

Slow graph editor

Rimevel 9 months ago • updated by Lazlo Bonin (Lead Developer) 3 months ago 20 2 duplicates

After working for a while in the graph editor I get massive lag spikes very fequently that make it hard to work. Mouse clicks fail to register and drag operations fail as well. Did a profile on the editor and discovered this:



Duplicates 2

Under Review

Hi Rimevel, welcome to the community!

Thanks for your report.

I've seen this happen on bigger graphs as well. I routinely do an optimization pass on the graph window, but there is such a massive amount of GUI code in there that makes it hard to get a smooth 60+ FPS. It is definitely one of my priorities though. I'll add another bigger optimization pass to the roadmap in the 1.1 cycle.

It would help me if you could expand the OnGraphGUI node in your screenshot and show me what are the main culprits on your machine.

In the mean time, I can recommend to split your graphs into smaller nested subgraphs to reduce the amount of graph elements on screen at once.

I only have about 15 - 25 nodes at most at every level in my graphs. And this is on a powerful i7 + 1080 computer :P I will try to divide things up a little more.

This is something I noticed as well. Noticeably bad when game and graph windows are both open and visible. Both by themselves are pretty good actually.  If you work with prefabs... Forget about it! It's barely useable on a keyboard prefab I have. I'll try to profile in about an hour and post.

I do work a lot with prefabs.

That would be why. I try to always drop in my prefab and apply after changes. Works pretty good there, but can still slow down after awhile. I'm on a 16 GB ram, i7 1060 laptop. Shouldn't have a problem with power here either.

Not receiving anything ridiculous on a fresh restart. Even with prefabs. Most I am seeing is a 30fps drop on panning the graph view. Goes right back to 60fps though I notice after using for awhile. I will check again later after I've worked for a bit.

I got it wrong.

I thought it was slow because of the values component, but it seems that other Bolt related components may be a problem.

anyway,
I can not open the Inspector.
Action is required.

I experience massive amounts of lag while panning a graph or moving a node. Drops to 5FPS. For some reason, this OnBeforeSerialize happens every 5 frames and seems to be the culprit.

So here's something odd... I discovered that Bolt's graph viewer only really slows down when the Unity Inspector is visible.

If I put the Graph Inspector on the same window as the Unity Inspector, then select the Graph Inspector tab (thus hiding the Unity Inspector), the framerate remains stable.

Hm, good catch, I'll investigate that. I believe that Unity tries to serialize/deserialize the inspected object at every frame whenever it is inspected for some reason. I'm not sure whether this is normal and by design or if Bolt's code is doing something wrong.

THANK YOU. I've been getting so frustrated with the massive input lag, it's been killing my productivity. This workaround helped me out big time.

So I investigated further, and that's definitely on Unity's end; nothing I can do about it.

Some options to improve performance by avoiding this constant serialization:

  • Use macros instead of embeds. This way, serializing the machine will not serialize the linked macro!
  • OR Hide the inspector tab behind any other tab in the same docked area
  • OR Use Shift+Space on the graph area to maximize it to the container window, hiding the inspector

me too…………But it's not sure what caused it.

run frames less than 5 frames
test game takes 10 seconds to open

When there is a large number of unit in graph, it will appear

if you minimze the both scripts "Variables", "Flow Machine" or "State Machine"... it works too...

+3

Just a heads up: this is the main focus for the v.1.2.4 update. The graph window GUI code will be entirely refactored to maximize speed and minimize memory allocation in the editor. One important aspect of this refactor will be making sure that the amount of nodes in a graph becomes unrelated to the performance (e.g. having a 1000-nodes graph shouldn't be significantly slower than a 20-nodes graph).

+5
Fixed in Alpha

Optimization complete! You can expect a steady 100+ FPS (aka no lag from Bolt whatsoever) in the next update.

My stress test is a gigantic, zoomed out flow graph:


In this view, with the optimizations, I now get a 45+ FPS and close-to-zero memory allocations (by editor standards):


But that's definitely the "worst case scenario". Most of the time, you will be zoomed in while working. So the next test is the same graph with hundreds of nodes, but this time zoomed in to a section:


In this case, the performance is really, really good. I now get a steady 150 FPS on my machine. If you look closely you'll see there's some additional GC allocation, but this is just the normal allocation for drawing inspector fields for the port's inline values (Unity internals, nothing I can do about this!).


I also optimized the speed and memory usage of inspectors in general. 

Overall, you can expect a much smoother Bolt editor in the next version. :)

That's so good to know! congratulations, amazing job!