benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

Bugfix for Tms#add! not updating @total

Open droleary opened this issue 1 year ago • 0 comments

Because the total instance variable only updates in initialize, it does not reflect the correct value when add! is called. This fixes the problem.

A test case is provided to show the bug/fix.

A more robust solution would be to use a total method instead to return the calculated value. It may be worth checking if such a solution is generally faster than doing the calculation every time a Tms object is created/updated. Benchmark the benchmarking! :-)

droleary avatar Jun 20 '24 18:06 droleary