Tech Reborn

Tech Reborn

30M Downloads

Use DFS instead of BFS for gathering cables

RolandPetrean opened this issue ยท 2 comments

commented

I've noticed that CableTickManager performs a Breadth-First Search instead of a Depth-First Search to find all connected cables, for no apparent reason. Using a stack instead of a queue is faster and more memory efficient in this case.

commented

How is it faster and more memory efficient? BFS is easier to implement than DFS without recursion, so unless we have someone profiling data showing that the BFS is a bottleneck I would keep the easier and existing option.