-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add lookup tables to DiagnosticsManager to speed up diagnostic clearing #1411
base: release-1.0.0
Are you sure you want to change the base?
Conversation
…e,tag,segment,etc, instead of looping all diagnostics
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 |
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 |
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 |
@@ -2785,6 +2785,23 @@ export class Util { | |||
} | |||
return resultType; | |||
} | |||
|
|||
public findCommonObjects<T>(...arrays: T[][]): T[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be something to address later, but array.includes will basically do a sequential loop over every element in the array. Could be pretty expensive. Is there any chance we could change the storage of these items into Set
instead? Then the .has will be a hash lookup (much faster). But adding to those sets is slightly slower than arrays.
I'm not sure the context here, just a thought.
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: