Skip to content

Commit

Permalink
Removed mistakenly cached brsFile.validationSegments
Browse files Browse the repository at this point in the history
  • Loading branch information
markwpearce committed Nov 2, 2023
1 parent 5b5c844 commit 0341f8d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions benchmarks/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,12 +817,12 @@ export class Program {
file: file
};
this.plugins.emit('beforeFileValidate', validateFileEvent);
const t0 = performance.now();
// const t0 = performance.now();
//emit an event to allow plugins to contribute to the file validation process
this.plugins.emit('onFileValidate', validateFileEvent);
file.isValidated = true;
const t1 = performance.now();
console.log('validateFileEvent', file.pkgPath, t1 - t0);
// const t1 = performance.now();
//console.log('validateFileEvent', file.pkgPath, t1 - t0);
this.plugins.emit('afterFileValidate', validateFileEvent);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/Scope.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3107,8 +3107,6 @@ describe('Scope', () => {

let symbolTables = getSymbolTableList();

console.log(symbolTables.map(x => `${x.name} ${x['siblings'].size}`));

symbolTables.forEach(x => expect(x['siblings'].size).to.eql(1, `${x.name} has wrong number of siblings`));

scope.unlinkSymbolTable();
Expand All @@ -3129,7 +3127,7 @@ describe('Scope', () => {
describe('performance', () => {

// eslint-disable-next-line func-names, prefer-arrow-callback
it('namespace linking performance', function () {
it.skip('namespace linking performance', function () {
this.timeout(30000); // this test takes a long time!
program.options.autoImportComponentScript = true;
const constFileContents = `
Expand Down
14 changes: 7 additions & 7 deletions src/Scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,21 +753,21 @@ export class Scope {
let callableContainerMap = util.getCallableContainersByLowerName(callables);

//Since statements from files are shared across multiple scopes, we need to link those statements to the current scope
const t0 = performance.now();
//const t0 = performance.now();
this.linkSymbolTable();
const t1 = performance.now();
console.log('onScopeValidate() - linkSymbolTable', this.name, t1 - t0);
//const t1 = performance.now();
//console.log('onScopeValidate() - linkSymbolTable', this.name, t1 - t0);
const scopeValidateEvent = {
program: this.program,
scope: this
};
this.program.plugins.emit('beforeScopeValidate', scopeValidateEvent);
this.program.plugins.emit('onScopeValidate', scopeValidateEvent);
const t2 = performance.now();
console.log('onScopeValidate() - scopeValidateEvent', this.name, t2 - t1);
//const t2 = performance.now();
//console.log('onScopeValidate() - scopeValidateEvent', this.name, t2 - t1);
this._validate(callableContainerMap);
const t3 = performance.now();
console.log('onScopeValidate() - _validate', this.name, t3 - t2);
//const t3 = performance.now();
//console.log('onScopeValidate() - _validate', this.name, t3 - t2);
this.program.plugins.emit('afterScopeValidate', scopeValidateEvent);
//unlink all symbol tables from this scope (so they don't accidentally stick around)
this.unlinkSymbolTable();
Expand Down
2 changes: 2 additions & 0 deletions src/bscPlugin/validation/ScopeValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export class ScopeValidator {

private walkFiles() {

//function signatures incompatible cross scopes

this.event.scope.enumerateOwnFiles((file) => {
if (isBrsFile(file)) {
const validationVisitor = createVisitor({
Expand Down
26 changes: 13 additions & 13 deletions src/files/BrsFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1335,16 +1335,16 @@ export class BrsFile implements File {
}

public getValidationSegments() {
return this.cache.getOrAdd(`validationSegments`, () => {
if (BrsFile.reduceReValidation) {
const t0 = performance.now();
const segments = this.validationSegmenter.getSegments();
const t1 = performance.now();
console.log('validationSegmenter.getSegments()', this.pkgPath, t1 - t0);
return segments;
}
return [this.ast];
});
// return this.cache.getOrAdd(`validationSegments`, () => {
if (BrsFile.reduceReValidation) {
//const t0 = performance.now();
const segments = this.validationSegmenter.getSegments();
//const t1 = performance.now();
// console.log('validationSegmenter.getSegments()', this.pkgPath, t1 - t0);
return segments;
}
return [this.ast];
// });
}

public markSegmentAsValidated(node: AstNode) {
Expand All @@ -1353,10 +1353,10 @@ export class BrsFile implements File {

public getNamespaceLookupObject() {
return this.cache.getOrAdd(`namespaceLookup`, () => {
const t0 = performance.now();
//const t0 = performance.now();
const nsLookup = this.buildNamespaceLookup();
const t1 = performance.now();
console.log('buildNamespaceLookup()', this.pkgPath, t1 - t0);
// const t1 = performance.now();
//console.log('buildNamespaceLookup()', this.pkgPath, t1 - t0);
return nsLookup;
});
}
Expand Down

0 comments on commit 0341f8d

Please sign in to comment.