-
Notifications
You must be signed in to change notification settings - Fork 37
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
Ordered history output #1209
Ordered history output #1209
Conversation
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.
Nice fix. Alternative approach might be to change the map to an ordered one? I think lexicographic key ordering would then just happen for free?
I think that's right, and we could do that too, except we would want to ensure that map ordering of In that sense since this PR is probably free from a performance perspective, I'm slightly inclined to just do the sorting here since it's critical that we're sorted at this stage. And even if we have an ordered map later on, this sorting will still just be an extra check. |
Yeah no objections to doing it this way. I think in the end the difference will be in the weeds. |
I think it might be useful to document somewhere that the packages are not iterated through in the order that they were added, which one might naively expect. |
+1 |
Good idea, done |
PR Summary
When populating history outputs, we index through a
Dictionary
of packages, which is an unordered map, and so the order in which we retrieve the packages isn't guaranteed. We've seen this cause inconsistencies in history outputs between platforms, and a more significant concern is that the order of the numbers in a history output could change between simulation runs.This is a simple fix that just always creates history outputs in alphabetical order of the name of the packages.
PR Checklist