Refactor Zone shape methods for efficient async rendering#19324
Open
gvkries wants to merge 2 commits into
Open
Refactor Zone shape methods for efficient async rendering#19324gvkries wants to merge 2 commits into
gvkries wants to merge 2 commits into
Conversation
Refactored Zone and ContentZone methods to use manual enumerator logic for more efficient asynchronous shape rendering. Extracted grouped rendering logic in ContentZone to a new static method, clarified grouping/ordering, and ensured proper enumerator disposal. This improves performance and code organization while preserving existing behavior.
Skrypt
reviewed
Jun 3, 2026
Skrypt
reviewed
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 pull request refactors the
ZoneandContentZoneshape methods inZoneShapes.csto optimize asynchronous rendering and improve resource management. The main changes include eliminating unnecessaryasync/awaitusage for synchronous paths, introducing efficient enumerator handling to minimize allocations, and ensuring proper disposal of enumerators. Additionally, the code now uses consistent casing for injected parameters and local variables.Asynchronous rendering and performance improvements
Refactored the
ZoneandContentZonemethods to avoid unnecessaryasync/awaitusage when allShapeExecuteAsynctasks complete synchronously, returning a completedTaskdirectly for improved performance. Added fast-path and slow-path execution logic to minimize allocations and context switches. [1] [2]Introduced helper methods
ZoneAwaitedandContentZoneAwaitedto handle asynchronous iteration only when necessary, ensuring efficient rendering of shapes and proper disposal of enumerators. [1] [2]Code consistency and cleanup
Standardized casing of injected parameters and local variables, e.g., using
displayAsyncandshapeFactoryinstead ofDisplayAsyncandShapeFactory, for consistency throughout the codebase. [1] [2] [3]Moved grouped rendering logic into a separate helper method
ContentZoneGroupedAsyncfor clarity and maintainability.Ensured enumerators are always disposed in both fast and slow paths to prevent resource leaks. [1] [2]