Conversation
* Performance improvment by mapping out midpoint to sinks on startup * Use existing routing methods * Debounce event handling * Check all signal types for route updates
* visualizeroutes allows visualizing configured routes based on tielines and signal type * can be filtered by source key, destination key, and type, along with partial matches for source & destination keys * visualizecurrentroutes visualizes what Essentials says is currently routed by type * uses same filtering as visualizeroutes * improvements to how the routing algorithm works
There was a problem hiding this comment.
Pull request overview
This PR adds route/tieline visualization and introduces several routing performance optimizations in Essentials Core, including TieLine indexing, “impossible route” caching, and startup pre-mapping of route descriptors. It also expands diagnostics via console output updates and a new Web API endpoint to fetch routing devices and tielines in one call.
Changes:
- Added console commands to list tielines and visualize mapped/current routes, plus startup route mapping after tielines load.
- Implemented routing optimizations: tieline indexes, impossible-route caching, and precomputed route-descriptor tables with preloaded lookup during execution.
- Added a CWS endpoint to return routing devices + tielines together, and improved
getroutingportsconsole output.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/PepperDash.Essentials/ControlSystem.cs | Adds console commands and triggers route mapping after tielines load |
| src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutingDevicesAndTieLinesHandler.cs | New endpoint returning routing devices/ports and tielines |
| src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs | Registers the new routingDevicesAndTieLines route |
| src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs | Adds midpoint→sink optimization and debounced sink updates; refactors root-source discovery |
| src/PepperDash.Essentials.Core/Routing/RouteSwitchDescriptor.cs | Simplifies/modernizes descriptor implementation and string output |
| src/PepperDash.Essentials.Core/Routing/RouteDescriptorCollection.cs | Adds public descriptor enumeration and changes de-dupe logic |
| src/PepperDash.Essentials.Core/Routing/RouteDescriptor.cs | Improves route string formatting; minor cleanup |
| src/PepperDash.Essentials.Core/Routing/Extensions.cs | Adds tieline indexing, impossible-route caching, startup mapping, and preloaded route lookup |
| src/PepperDash.Essentials.Core/Devices/DeviceManager.cs | Improves console output to include port signal type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…s. Resolve issues with client closing websocket connection to DebugWebsocketSink
…grate asset loading
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces significant performance optimizations and new features to the routing logic in the Essentials Core, particularly in the
Extensionsclass. The main improvements include the addition of indexed lookups forTieLines, caching of impossible routes to avoid redundant calculations, and the introduction of a pre-mapping mechanism for route descriptors. These changes are aimed at making route discovery and execution much faster and more efficient, especially in large systems.Routing Performance Optimizations:
_tieLinesByDestination,_tieLinesBySource) forTieLinesto speed up route lookups and provided methods to initialize and use these indexes instead of repeated LINQ queries._impossibleRoutes) for impossible routes to prevent repeated attempts at finding non-existent paths, including logic to add to and clear this cache. [1] [2]Route Descriptor Pre-mapping and Utilization:
RouteDescriptorsdictionary, mapping each signal type to a collection ofRouteDescriptorobjects, and implemented aMapDestinationsToSourcesmethod to precompute and store all possible routes at startup. [1] [2]Other Improvements and Bug Fixes:
GetRouteToSourceto ensure only valid, non-empty route descriptors are returned, preventing downstream errors.DeviceManager.GetRoutingPortsto display both the key and signal type for each port, aiding in debugging and diagnostics.These changes collectively make routing operations more scalable and reliable, particularly in environments with many devices and complex routing requirements.