Avoid creating transient objects when origin file is reloaded #483
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves origins file reloading in backwards compatibility mode: No longer are transient objects being unnecessarily created.
The current origins config translator is wasteful. It creates creates routing objects for a full configuration regardless of changes. It doesn't apply all those objects whoever. When updating the database, it checks if a new object is identical to the the existing one. If so, the newly created object is simply thrown away. This approach creates unnecessary churn. A large configuration may contain hundreds of objects. It is pointless to recreate all of them if only one object actually changes.
This PR defers object creation until the database is actually being updated, therefore avoiding unnecessary object creation.