Skip to content

Commit

Permalink
Annotate slow code for future perf improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Breck Yunits authored and Breck Yunits committed Jun 22, 2024
1 parent 5436d1c commit af2dd5d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions parsers/Parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,10 @@ abstract class ParserBackedNode extends TreeNode {
}

private get cellErrors() {
return this.parsedCells.map(check => check.getErrorIfAny()).filter(identity => identity)
const { parsedCells } = this // todo: speedup. takes ~3s on pldb.

// todo: speedup getErrorIfAny. takes ~3s on pldb.
return parsedCells.map(check => check.getErrorIfAny()).filter(identity => identity)
}

private get singleParserUsedTwiceErrors() {
Expand Down Expand Up @@ -566,10 +569,10 @@ abstract class ParserBackedNode extends TreeNode {
get scopeErrors() {
let errors: scrollNotationTypes.TreeError[] = []
const def = this.definition
if (def.isSingle) errors = errors.concat(this.singleParserUsedTwiceErrors)
if (def.isUniqueLine) errors = errors.concat(this.uniqueLineAppearsTwiceErrors)
if (def.isSingle) errors = errors.concat(this.singleParserUsedTwiceErrors) // todo: speedup. takes ~1s on pldb.
if (def.isUniqueLine) errors = errors.concat(this.uniqueLineAppearsTwiceErrors) // todo: speedup. takes ~1s on pldb.

const { requiredNodeErrors } = this
const { requiredNodeErrors } = this // todo: speedup. takes ~1.5s on pldb.
if (requiredNodeErrors.length) errors = errors.concat(requiredNodeErrors)
return errors
}
Expand Down

0 comments on commit af2dd5d

Please sign in to comment.