Skip to content

Commit

Permalink
batchRouting: subtract startIndex from calc/sec count
Browse files Browse the repository at this point in the history
When a job starts from a checkpoint, we need to substract the `startIndex`
from the `completedRoutingCount` to get the actual of calculations done,
otherwise we get slowly decreasing results.
  • Loading branch information
tahini committed Sep 13, 2024
1 parent 68d6380 commit ecdf260
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ class TrRoutingBatch {
};
const logOdTripAfter = (index: number) => {
if (benchmarkStart >= 0 && index > 0 && index % 100 === 0) {
// Log the calculation speed every 100 calculations. Divide the number of completed calculation (substract startIndex if the task was resumed) by the time taken in seconds. Round to 2 decimals
console.log(
'calc/sec',
Math.round(
(100 * completedRoutingsCount) / ((1 / 1000) * (performance.now() - benchmarkStart))
(100 * (completedRoutingsCount - startIndex)) /
((performance.now() - benchmarkStart) / 1000)
) / 100
);
}
Expand Down

0 comments on commit ecdf260

Please sign in to comment.