-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mitigate overflow when calculating ETA #78
Mitigate overflow when calculating ETA #78
Conversation
progress_ > 0 ? static_cast<long long>(elapsed.count() * | ||
(max_progress / progress_)) | ||
: 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the single_include is generated, can you make these changes to include/indicators/block_progress_bar.hpp
and include/indicators/progress_spinner.hpp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do. Is the appropriate call for running the generator documented somewhere so I can make sure single include is updated the correct way as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked right over it! Thanks!
The counting up problem is due to integer truncation. For example, at step 51/100, After thinking about this more, there are three ways we can organize the order of operations here and I think they all have problems:
It seems like the last option is the least bad, but I only have my use case to go on. An alternative that requires more work but is probably more stable is to keep a rolling average of the iteration rate and use that to project ETA. That appears to be what tqdm does. EDIT: Or we just do all the math as floats. |
I ended up going for the floating point approach. The |
Mitigates the overflow that occurs when max progress is very large.
See #77