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

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

Open
wants to merge 4 commits into
base: release-1.0.0
Choose a base branch
from

Conversation

markwpearce
Copy link
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

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

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

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[] {
Copy link
Member

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.

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