Skip to content

Commit

Permalink
Merge pull request #10330 from keymanapp/fix/web/execution-timer-outl…
Browse files Browse the repository at this point in the history
…ier-logic

fix(web): prediction time-limiter issues, performance 📜
  • Loading branch information
jahorton authored Jan 12, 2024
2 parents c220525 + c25ad48 commit bd3d7cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions common/web/lm-worker/src/main/correction/distance-modeler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,14 +641,15 @@ export class SearchSpace {
* Ignore any zero-ms length intervals; they'd make the logic much
* messier than necessary otherwise.
*/
if(delta) {
if(delta && delta > this.largestIntervals[0]) {
// If the currently-observed interval is longer than the shortest of the 3
// previously-observed longest intervals, replace it.
if(this.largestIntervals.length > 2 && delta > this.largestIntervals[0]) {
if(this.largestIntervals.length > 2) {
this.largestIntervals[0] = delta;
} else {
this.largestIntervals.push(delta);
}

// Puts the list in ascending order. Shortest of the list becomes the head,
// longest one the tail.
this.largestIntervals.sort();
Expand Down

0 comments on commit bd3d7cd

Please sign in to comment.