Nelarius / imnodes

A small, dependency-free node editor for dear imgui
MIT License
1.94k stars 237 forks source link

Very slow with many nodes #154

Open ahmidou opened 2 years ago

ahmidou commented 2 years ago

Hi, I was testing different ImGui node based solutions for large graphs and found out imnode doesn't scale well with many nodes. for 500 nodes I'm under 4fps vs 150fps in imgui-node-editor. The first curlpit happends when generating the nodes procedurally and they are all overlapping the ResolveHoveredPin is taking forever and the applicayion just doesn't respond anymore.. If I make sure the node are not overlap, the prefs are still very low ( < 4 fps)

Nelarius commented 2 years ago

Thanks for reporting the issue!

There is some quadratic time complexity in both ResolveHoveredPin and ResolveHoveredNode which could definitely be cleaned up. Not a quick fix, but removing the quadratic complexity would probably significantly increase performance with your node counts.