✨ Enhance performance logging in snapshot and serialization processes #1950
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 focuses on enhancing performance tracking and debugging capabilities in the DOM serialization process. Key changes include adding performance metrics to the serialized output, tracking the number of cloned nodes, and improving logging for snapshots. These updates aim to provide better insights into the performance and behavior of the DOM serialization process.
Enhancements to performance tracking:
packages/dom/src/serialize-dom.js
: Added performance timing to measure the duration of the DOM serialization process (serializationTime
) and included it in theperfInfo
object of the serialized output. TheperfInfo
object also tracks the number of cloned nodes (clonedNodeCount
), the length of the final HTML (finalHtmlLength
), and the number of resources (resourceCount
). [1] [2] [3]Improvements to debugging:
packages/core/src/discovery.js
: Enhanced thedebugSnapshotOptions
function to log performance information (perfInfo
) from thedomSnapshot
object, if available.Code updates for node cloning:
packages/dom/src/clone-dom.js
: Incremented a newclonedNodeCount
property in thectx
object to track the number of cloned nodes during the DOM serialization process.Miscellaneous:
packages/dom/src/serialize-dom.js
: Added a global reference to theperformance
object to enable performance timing.