Skip to content

Fix tMin_ reset when an iteration has zero duration#2464

Merged
dellaert merged 1 commit intoborglab:developfrom
jashshah999:fix/timing-tmin-reset
Mar 13, 2026
Merged

Fix tMin_ reset when an iteration has zero duration#2464
dellaert merged 1 commit intoborglab:developfrom
jashshah999:fix/timing-tmin-reset

Conversation

@jashshah999
Copy link
Copy Markdown
Contributor

Summary

TimingOutline::tMin_ is initialized to 0, and finishedIteration() uses tMin_ == 0 as a proxy for "first iteration". This means any iteration that legitimately completes in 0 microseconds causes tMin_ to keep resetting, producing incorrect minimum timing statistics.

Fix: initialize tMin_ to std::numeric_limits<size_t>::max() so any real measurement is naturally smaller, and simplify the comparison in finishedIteration().

Fixes #1636

tMin_ was initialized to 0 and the finishedIteration() check used
tMin_ == 0 as a proxy for 'first iteration'. This caused tMin_ to
reset whenever an iteration legitimately completed in 0 microseconds,
producing incorrect minimum timing statistics.

Initialize tMin_ to std::numeric_limits<size_t>::max() so that any
real timing value is smaller, and simplify the comparison.

Fixes borglab#1636
Copy link
Copy Markdown
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks !!!

@dellaert dellaert merged commit 7e2e3f2 into borglab:develop Mar 13, 2026
34 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tMin_ resets when an iteration has 0 us duration.

2 participants