|
|
@ -24,7 +24,7 @@ export default class CodeParserAntlrService { |
|
|
|
worker: Worker |
|
|
|
worker: Worker |
|
|
|
parserStartTime: number = 0 |
|
|
|
parserStartTime: number = 0 |
|
|
|
workerTimer: NodeJS.Timer |
|
|
|
workerTimer: NodeJS.Timer |
|
|
|
parserTreshHold: number = 10 |
|
|
|
parserTreshold: number = 10 |
|
|
|
parserTresholdSampleAmount = 3 |
|
|
|
parserTresholdSampleAmount = 3 |
|
|
|
cache: { |
|
|
|
cache: { |
|
|
|
[name: string]: { |
|
|
|
[name: string]: { |
|
|
@ -75,7 +75,7 @@ export default class CodeParserAntlrService { |
|
|
|
// calculate average of durations to determine if the parsing should be disabled
|
|
|
|
// calculate average of durations to determine if the parsing should be disabled
|
|
|
|
const values = [...this.cache[file].blockDurations] |
|
|
|
const values = [...this.cache[file].blockDurations] |
|
|
|
const average = values.reduce((a, b) => a + b, 0) / values.length |
|
|
|
const average = values.reduce((a, b) => a + b, 0) / values.length |
|
|
|
if (average > this.parserTreshHold) { |
|
|
|
if (average > this.parserTreshold) { |
|
|
|
this.cache[file].parsingEnabled = false |
|
|
|
this.cache[file].parsingEnabled = false |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.cache[file].parsingEnabled = true |
|
|
|
this.cache[file].parsingEnabled = true |
|
|
|