Skip to content

Conversation

@andrew-welker
Copy link
Contributor

@andrew-welker andrew-welker commented Jan 14, 2026

This pull request introduces significant performance optimizations and new features to the routing logic in the Essentials Core, particularly in the Extensions class. The main improvements include the addition of indexed lookups for TieLines, 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:

  • Added indexed lookup dictionaries (_tieLinesByDestination, _tieLinesBySource) for TieLines to speed up route lookups and provided methods to initialize and use these indexes instead of repeated LINQ queries.
  • Introduced a cache (_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:

  • Added a global RouteDescriptors dictionary, mapping each signal type to a collection of RouteDescriptor objects, and implemented a MapDestinationsToSources method to precompute and store all possible routes at startup. [1] [2]
  • Modified the routing execution logic to use pre-mapped route descriptors when possible, falling back to dynamic route discovery only if a pre-mapped route is not found.

Other Improvements and Bug Fixes:

  • Improved the return logic of GetRouteToSource to ensure only valid, non-empty route descriptors are returned, preventing downstream errors.
  • Enhanced console output in DeviceManager.GetRoutingPorts to 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.

  • feat: improve routing feedback manager
  • fix: getroutingports command now prints port types
  • feat: map routes/tielines at startup and new console commands
  • feat: add CWS endpoint to get routing devices & tielines together

* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants