You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[portsorch] Fixed port comparison logic executed every doTask for every port (#3821)
* [portsorch] Fixed port comparison logic executed every doTask for every port
What I did:
- Removed TODO comment about N² loop issue that was causing initPort() to be called multiple times
- Fixed state checking logic to use explicit PORT_CONFIG_RECEIVED instead of != PORT_CONFIG_MISSING
- Added proper handling for PORT_CONFIG_DONE state to prevent duplicate port initialization
- Added error handling for port addition failures in the new state handling block
Why I did it:
initPort is beeing called 36138312 times on a system with 514 ports
during cold boot and shows up in profilers. This is because the port
comparison logic is invoked every port update and loops for every port.
For every port that hasn't changed its lanes initPort is called. This is
an N^2 loop and causes inefficient PORT table handling in cold boot.
Saved around ~6 sec in cold boot downtime test with this change.
Testing:
- Verified port initialization works correctly in both initial and runtime port split cases.
- Confirmed no duplicate port initialization occurs
0 commit comments