Skip to content
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

Limit unit magnitude + precision to fit into 63 bits. #16

Conversation

marshallpierce
Copy link
Collaborator

Approach and tests ported from equivalent PR to Java impl.

This addresses #14.

I split up the unit tests into multiple files based on the sort of thing they were testing. We're going to end up with a lot of tests and now seemed like a good time to start putting some structure around that.

@marshallpierce marshallpierce force-pushed the better-fix-for-overflow-with-large-unit_magnitude branch 5 times, most recently from 2f66008 to 00f087b Compare February 19, 2017 01:36
@@ -0,0 +1,14 @@
use super::Histogram;

#[path = "helpers.rs"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apparently the compiler is picky about this as of recently; I was surprised too. In future versions it will be a hard error, and right now it's a warning (which this project's setup makes an error anyway): rust-lang/rust#37872

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh wow, that's so strange. I know this is kind of annoying, but you could submit the #[path] changes in a separate PR (including the separation of helpers.rs) so that I have a way of referring back to that particular change? I'd then be happy to merge both that and this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK. What sort of "referring back" do you need to do? It would be nice to avoid these git gymnastics; can you explain more about your workflow?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In general, I like having one merge commit per distinct logical change, which translates into one PR per logical change. This makes it easier to find both where a change was introduced, and the conversation around why a change was introduced (by looking at the discussion in the corresponding PR). This also has the advantage that it more cleanly tracks the dependencies of a PR — we now know that the change in #18 is not necessary for #16, whereas the same would not be as easy to determine if 865a2e8 was just merged as a part of this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One example when this is really handy is when a bug is found and we need to bisect some day far into the future. blame also works a lot better when the merge that introduces the change is directly tied to the reason for the change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm... Having the same motivations, I come to the opposite conclusion. :( I want branches that represent a feature in its entirety, not a semi-arbitrary fragment of an overall feature. I would like to be able to locate the merge that introduced a bug, and then bisect along the branch that led to that merge, knowing that it has a good chance of navigating through every important change that's part of that feature. In what way is #18 not necessary for #16? It was merged before it, and #16 would not apply cleanly without it. And yet, the motivation for #18 is absent until you get to #16: the addition of another large block of tests.

IMO, developing an abstraction (of which splitting unit tests is a simple example) in a vacuum is a good way to get an abstraction that doesn't fit with the end goal. Or, going the other way, retroactively splitting it out is a good way to end up with a mangled branch -- on my first attempt, I didn't delete the old tests.rs, for instance.

Oh well. I guess this isn't likely to change your mind. We all come at this with different histories and biases.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting... I view the multiple commits that are a part of a single PR that way -- as the thing I would bisect further if the merge of that PR introduced a bug. But in #18 vs #16, if #18 introduced a bug, then clearly #16 was not at fault. And furthermore, #16 could be modified pretty easily to avoid the change in #18. The two changes are basically orthogonal.

I'm happy to not be as strict about this though. This is slowly but surely becoming as much your project as mine, and if that's how you prefer your merges, I'm okay with that 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for being flexible! I shall also try to be slightly more granular than I normally would be in my PR's. ;)

This sort of stuff is all so path-dependent: once bitten twice shy, and where we've been bitten is very individual.

@marshallpierce marshallpierce force-pushed the better-fix-for-overflow-with-large-unit_magnitude branch from 00f087b to 10ac705 Compare February 20, 2017 04:22
@jonhoo
Copy link
Collaborator

jonhoo commented Feb 20, 2017

I merged #18. Can you rebase onto master, and then I'll merge this too.

@marshallpierce marshallpierce force-pushed the better-fix-for-overflow-with-large-unit_magnitude branch from 10ac705 to e2891c7 Compare February 20, 2017 16:24
@marshallpierce
Copy link
Collaborator Author

Rebase is done.

@marshallpierce marshallpierce mentioned this pull request Feb 20, 2017
@jonhoo jonhoo merged commit 1976604 into HdrHistogram:master Feb 20, 2017
@marshallpierce marshallpierce deleted the better-fix-for-overflow-with-large-unit_magnitude branch February 20, 2017 19:20
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.

2 participants