taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 1ad4449348088db15c243c7cb2d0d5170b337c50
parent f061cbd2f3f7bb948926f143a7157cc2c9cb51d3
Author: Florian Dold <dold@taler.net>
Date:   Tue, 21 Jul 2026 10:59:04 +0200

util: compute the performance average from the running total

avgDurationMs was updated as (avg + sample) / 2, an exponential moving
average.  The table is sorted on this value, so it also drove eviction.

Diffstat:
Mpackages/taler-util/src/performance.ts | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/packages/taler-util/src/performance.ts b/packages/taler-util/src/performance.ts @@ -229,9 +229,6 @@ export namespace PerformanceTable { tab[stat.type]?.push(stat); } else { const existing = tab[stat.type]!![index]; - existing.avgDurationMs = Math.floor( - (existing.avgDurationMs + stat.totalDurationMs) / 2, - ); existing.maxDurationMs = Math.max( existing.maxDurationMs, stat.maxDurationMs, @@ -242,7 +239,10 @@ export namespace PerformanceTable { ); existing.totalDurationMs = existing.totalDurationMs + stat.totalDurationMs; - existing.count += 1; + existing.count += stat.count; + existing.avgDurationMs = Math.floor( + existing.totalDurationMs / existing.count, + ); tab[stat.type]!![index] = existing; } }