Skip to content

Add lookup tables to DiagnosticsManager to speed up diagnostic clearing#1411

Merged
TwitchBronBron merged 17 commits into
release-1.0.0from
scope_validation_performance
Feb 24, 2025
Merged

Add lookup tables to DiagnosticsManager to speed up diagnostic clearing#1411
TwitchBronBron merged 17 commits into
release-1.0.0from
scope_validation_performance

Conversation

@markwpearce
Copy link
Copy Markdown
Collaborator

@markwpearce markwpearce commented Feb 13, 2025

TBH, I'm not sure if this will speed up validation. However, there are many times in the validation process when the Diagnostic Manager needs to clear all diagnostics based on scope, file, tag, etc. Previously, this was done by looping all diagnostics, so if there are lots, it probably went slower and slower. This change should make it much more quick to find the diagnostics that need to be cleared.

Also added some more fine-grained Scope Validation metrics that are printed out with log-level debug:

[02:25:25:633 PM] [prj0] Validating scope components/search/SearchRow.xml
[02:25:25:634 PM] [prj0] Validating scope components/search/SearchRow.xml finished. (1.46ms)
[02:25:25:634 PM] [prj0] components/search/SearchRow.xml segment metrics:
[02:25:25:634 PM] [prj0]  -  components/search/SearchRow.brs 11
[02:25:25:634 PM] [prj0] components/search/SearchRow.xml total segments validated 11
[02:25:25:634 PM] [prj0] Validation Metrics (Scope: components/search/SearchRow.xml): fileWalkTime=0.953ms, flagDuplicateFunctionTime=0.21ms, classValidationTime=0.13ms, scriptImportValidationTime=0.40ms, xmlValidationTime=0.17ms
[02:25:25:634 PM] [prj0] BscPlugin onScopeValidate finished. (1.72ms)

@markwpearce markwpearce added the create-package create a temporary npm package on every commit label Feb 13, 2025
@markwpearce markwpearce added this to the v1.0.0 milestone Feb 13, 2025
@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on f77c753. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250213160536.tgz

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on 55e91ba. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250214142216.tgz

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on 2be68e9. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250214154143.tgz

Comment thread src/util.ts Outdated
@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on dd4c33b. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250220174529.tgz

Comment thread src/CrossScopeValidator.ts Outdated
@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on be504ae. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250220181209.tgz

Comment thread src/files/BrsFile.ts
Comment thread src/Scope.ts

clonedNsContainer.symbolTable.mergeSymbolTable(nsContainer.symbolTable);
namespaceLookup.set(lowerNamespaceName, clonedNsContainer);
} else {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

eliminates a bunch of empty/useless maps

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on c072b43. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250220181710.tgz

Comment thread src/Scope.ts
}
this.linkSymbolTableDisposables = [];

this.cache.delete('namespaceLookup');
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The namespaceLookup was stored in the cache, and not needed outside of when the scope was linked... deleting it here makes sense

@markwpearce
Copy link
Copy Markdown
Collaborator Author

Some of the work here is to make the overall memory footprint smaller:

Here's before & after snapshots of the heap memory when validating & building Jellyfin (with an extra file that adds 4000+ namespaces):
image

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on 1ba732c. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250220200213.tgz

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on 18dd8db. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250222234304.tgz

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on 6b46ca8. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250224133136.tgz

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on f5af66a. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250224180010.tgz

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on 87502c2. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250224194448.tgz

@rokucommunity-bot
Copy link
Copy Markdown
Contributor

Hey there! I just built a new temporary npm package based on 9f29569. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/brighterscript/releases/download/v0.0.0-packages/brighterscript-1.0.0-alpha.44-scope-validation-performance.20250224203107.tgz

@TwitchBronBron TwitchBronBron merged commit 37997a8 into release-1.0.0 Feb 24, 2025
@TwitchBronBron TwitchBronBron deleted the scope_validation_performance branch February 24, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-package create a temporary npm package on every commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants