Skip to content
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

Performance improvements for large projects #140

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

JustNoon
Copy link
Contributor

@JustNoon JustNoon commented Aug 17, 2023

Performance changes:

  • lastMacroCache is now invalidated using lodash after parameter comparison. This was on the order of 1000x faster in worst case scenarios (~4000 macros)
  • Initial passage collection and parsing now runs asynchronously. This was on the order of 10x faster in worst case scenarios. (~500 files/ 10k passages)
  • parseConfiguration now runs asynchronously. Each additional configuration file now introduces minimal performance impact

Function changes:

  • changeStoryFormat return type changed from Promise<void> to Promise<vscode.TextDocument>
  • yamlParse made into separate function for easier error management and future language specific handling. configuration.ts:115
  • parseRawText and parseText now accept an extra optional parameter that bypasses updating workspaceState. Passages will be resolved through or stored in this parameter
  • macroList and enumList are explicitely async functions now instead of TS rewriting them
  • hover and hoverProvider now respect cancellation tokens
  • isObjectSimpleEqual has been commented out in favor of lodash's isEqual

Bug Fixes:

  • Parameter compare could crash the extension if parameters failed to load completely

Package updates:

  • glob updated to 7.2.0
  • lodash 4.17.21 installed

Future considerations:

  • glob can be removed by switching to vscode.workspace.findFiles which is faster in almost all circumstances (it manages its own cache)
  • updateDiagnostics and parseText can be optimized further
  • macroCache updating could be simplified and improved to run asynchronously without so many loops

JustNoon added a commit to JustNoon/twee3-language-tools that referenced this pull request Aug 17, 2023
JustNoon added a commit to JustNoon/twee3-language-tools that referenced this pull request Aug 17, 2023
@JustNoon JustNoon mentioned this pull request Aug 17, 2023
@cyrusfirheir cyrusfirheir merged commit bcc621e into cyrusfirheir:master Aug 18, 2023
@JustNoon JustNoon deleted the performance branch August 18, 2023 13:20
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.

2 participants