Skip to content

[Regression] [Performance] Fix delayed sidebar hover animation for large projects #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

mportiz08
Copy link
Contributor

Bug/issue #, if applicable: #919 (rdar://147239963)

Summary

Fixes a regression with the performance of the sidebar hover animation that can be very slow for large projects with many sidebar items.

This regression was introduced with #904.

The cause of the poor performance turned out to be a big jump in memory usage, which noticeably impacted the performance of hovering over sidebar items. By utilizing Object.freeze again, we prevent Vue from creating a large number of proxy items that it would normally use to track changes to state data and thereby keep the memory usage down for projects with many index nodes. Since we don't modify this data after fetching/deserializing it, this should be an acceptable tradeoff.

In the future if we need to handle even larger amounts of data or need to track changes to these nodes, we will likely need to come up with a way of streaming this data instead of storing it all in memory.

Testing

Steps:

  1. Use this branch to render a DocC catalog with a large number of navigation items.
  2. Compare the performance of the hover effect for sidebar items and/or compare JS heap snapshots between this branch and the main branch to verify that the memory usage and performance better matches the behavior before Navigator related changes to allow further customization #904 was merged.
  3. Ensure there are no behavioral regressions with the function of the sidebar.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests (no straightforward way to unit test this change)
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

@mportiz08 mportiz08 requested a review from marinaaisa March 18, 2025 20:03
@mportiz08 mportiz08 mentioned this pull request Mar 18, 2025
2 tasks
Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mportiz08
Copy link
Contributor Author

@swift-ci test

@mportiz08 mportiz08 requested a review from eango March 19, 2025 18:19
@mportiz08 mportiz08 merged commit b272b2c into swiftlang:main Mar 19, 2025
1 check passed
@mportiz08 mportiz08 deleted the perf/fix-laggy-sidebar-hover branch March 19, 2025 20:28
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.

3 participants