Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Merged by Bors] - Cleanups in diagnostics #3871
[Merged by Bors] - Cleanups in diagnostics #3871
Changes from all commits
ef81c3c
4601713
f0d7756
c7fa052
40f14cd
e248f28
950ee74
0be1033
9133e42
64c73c4
a81a287
368a096
a71de3f
d969d2a
da483ba
0407c79
55959a3
c913286
03a9147
5cf7a6a
96ba1f7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 am really not thrilled with the fact that all measurements are assumed to be f64, but that's probably out of scope.
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.
yup me neither 🙁
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 feel like there's a possibility of getting a consistent bias towards the numbers increasing, due to floating point ordering/precision madness.
OTOH, I don't care enough to come up with a clever way to fix it, unless someone runs into it in practise.
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.
A potential solution would be to switch form storing the sum to storing the simple moving average directly. An incremental SMA is calculated as
where the impact of any rounding error trends towards zero.
The main advantage of the incremental SMA over the typical and current$\frac{ X_t + X_{t-1} + \cdots + X_{t-n} }{ n }$ is not needing to store the historical readings, though, and it's perhaps useful to have the history, especially for discrete diagnostics rather than continuous.
Perhaps the best solution really is to separate discrete from continuous diagnostics.
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.
Strike that formula that's what I get for going off of memory. That's not a correct simple moving average; the SMA does require keeping track of the history. The correct incremental SMA formula is$$SMA_{k,\text{next}} = SMA_{k,\text{prev}} + \frac{1}{k}\left( p_{n+1} - p_{n-k+1} \right)$$ . What I wrote above is some odd form of a weighted moving average where each sample contributes IIUC $1/(n+\text{age})$ . This might be the standard weighted moving average; I'm not sure and my math brain is not on enough to determine that for sure.
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.
🔥
It took me longer than I'd like to understand this change, as I thought you were removing it from printing. This confused me greatly.
A reminder in case anyone else is in the same situation: https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html#captured-identifiers-in-format-strings
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.
just to make sure that Bevy MSRV is latest!