Skip to content

Conversation

@cte
Copy link
Collaborator

@cte cte commented May 2, 2025

Context

Using a noisy terminal command I was able to get Roo into a state where it was performing extremely poorly due to excessive calls to postStateToWebview. When I profiled the app a few things stood out, but this was the lowest hanging fruit. The getCustomModes call is slow, and we were calling it twice in row instead of just using the first result.


Important

Improve CustomModesManager performance by implementing caching for getCustomModes() with cache invalidation and TTL handling.

  • Performance Improvements:
    • Implement caching in CustomModesManager for getCustomModes() with a TTL of 10 seconds to reduce redundant file reads.
    • Cache is invalidated on mode updates, deletions, and after TTL expiration.
  • Code Changes:
    • Add cachedModes and cachedAt properties to CustomModesManager.
    • Add clearCache() method to CustomModesManager to handle cache invalidation.
    • Refactor getCustomModes() to utilize caching logic.
  • Tests:
    • Add tests in CustomModesManager.test.ts to verify caching behavior, including cache invalidation on updates and deletions, and TTL expiration.
  • Miscellaneous:
    • Minor refactoring in CustomModesManager.ts for code clarity.
    • Update ClineProvider.ts to use cached customModes in postStateToWebview().

This description was created by Ellipsis for 431d4c0. You can customize this summary. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented May 2, 2025

⚠️ No Changeset found

Latest commit: 431d4c0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels May 2, 2025
customSupportPrompts: customSupportPrompts ?? {},
enhancementApiConfigId,
autoApprovalEnabled: autoApprovalEnabled ?? false,
customModes: await this.customModesManager.getCustomModes(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

😬

@adamhill
Copy link
Contributor

adamhill commented May 2, 2025

You think it might be a good idea to establish a pattern eventually for new contributors to follow for "streamy or chunky" large volume flow like..... a RooQueue? <runs_away/>

edit. Or does TS have a popular Reactive framework that isn't too weird for devs to pickup? Pub / Sub sometimes turns people off with all the higher-order function stuff like Zip and Merge.

@cte cte merged commit a2dcc18 into main May 2, 2025
19 checks passed
@cte cte deleted the cte/extension-state-performance branch May 2, 2025 21:52
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap May 2, 2025
mehmetsunkur pushed a commit to mehmetsunkur/Roo-Code that referenced this pull request May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants