Skip to content

Commit

Permalink
Merge pull request #80 from clinuxrulz/collect-cycles-performance
Browse files Browse the repository at this point in the history
reduced how often collect cycles is called
  • Loading branch information
Stephen Blackheath committed Mar 18, 2019
2 parents 16b1b1c + 00a7260 commit bd14e2b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib/sodium/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class Transaction
private sampleQ: Array<() => void> = [];
private lastQ: Array<() => void> = [];
private postQ: Array<() => void> = null;
private collectCyclesAtEnd: boolean = false;
private static collectCyclesAtEnd: boolean = false;

prioritized(target: Vertex, action: () => void): void
{
Expand All @@ -72,7 +72,7 @@ export class Transaction

public static _collectCyclesAtEnd(): void
{
Transaction.run(() => Transaction.currentTransaction.collectCyclesAtEnd = true);
Transaction.run(() => Transaction.collectCyclesAtEnd = true);
}

/**
Expand Down Expand Up @@ -178,10 +178,6 @@ export class Transaction
}
this.postQ = null;
}
if (this.collectCyclesAtEnd) {
Vertex.collectCycles();
this.collectCyclesAtEnd = false;
}
}

/**
Expand Down Expand Up @@ -223,6 +219,10 @@ export class Transaction
{
Transaction.currentTransaction.close();
Transaction.currentTransaction = null;
if (Transaction.collectCyclesAtEnd) {
Vertex.collectCycles();
Transaction.collectCyclesAtEnd = false;
}
}
return a;
}
Expand Down

0 comments on commit bd14e2b

Please sign in to comment.