-
Notifications
You must be signed in to change notification settings - Fork 695
ObjectSizerJUnitTest #7905
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
ObjectSizerJUnitTest #7905
Conversation
|
Can you explain the motivation for this change? Doesn't this test seem to succeed on the main branch? |
Ah I guess this is to make it succeed on Azul |
| assertEquals(roundup(OBJECT_SIZE + REFERENCE_SIZE), ObjectGraphSizer.size(new TestObject4())); | ||
| assertEquals(roundup(OBJECT_SIZE + REFERENCE_SIZE) + roundup(OBJECT_SIZE + 4), | ||
| if (SystemUtils.isAzulJVM()) { | ||
| assertEquals(roundup(OBJECT_SIZE + REFERENCE_SIZE + 8), ObjectGraphSizer.size(new TestObject4())); |
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.
This '+ 8' seems suspicious to me - doesn't this indicate that either OBJECT_SIZE, REFERENCE_SIZE or ObjectGraphSizer.size needs to be different on Azul?
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.
The size is different on Azul and 8 had to be added.
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.
but does it make sense to add it in the test? wouldn't it make more sense to add it to OBJECT_SIZE or REFERENCE_SIZE? Or is there something in the calculation that needs to be different?
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.
We cannot change OBJECT_SIZE or REFERENCE_SIZE just for Azul because they are also used for other JVM implementations.
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.
Right, but the initialization of those values could depend on SystemUtils.isAzulJVM(), right? And the fact that this test failed perhaps suggests it should?
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.
As you can see in lines 35-36, OBJECT_SIZE and REFERENCE_SIZE are consistent whether it's Azul or not: assertEquals(roundup(OBJECT_SIZE * 2 + REFERENCE_SIZE),
ObjectGraphSizer.size(new TestObject3(), true));
That's why we cannot change those for Azul.
|
Whoa, I get that you're eager to get contributions in, but self-merging when there's open review feedback is unexpected. Self-merging when there are no reviews is also not great. You could at least have asked for reviews on the PRs, on Slack or on the dev list. |
|
@raboof , I apologize for self-merging in this case — I realize now that it was not the right approach, particularly while there was still open feedback. The reason I proceeded was that I hadn’t received any feedback after my last comment, but I understand that I should have requested reviews more explicitly and waited. I truly appreciate the time and effort that goes into providing review feedback, and I’ll make sure to follow the proper process and reach out on Slack or the dev list before merging in the future. Please feel free to undo the merge if you find this is not the correct solution. Thank you for calling this out and helping me improve. |
|
Thanks ;). I won't revert the change, but I still don't find |
|
Thank you very much for the thoughtful feedback, @raboof. I fully agree that the assertion roundup(OBJECT_SIZE + REFERENCE_SIZE + 8) does not clearly communicate why this should be the expected value, and in hindsight it does not provide sufficient motivation for the Azul JVM scenario. I made an effort to investigate why Azul’s JVM behaves differently here, but unfortunately I have not been able to determine the underlying reason. Because of that, I must admit I am not entirely satisfied with the current solution, and I share your concern that it may not be the most appropriate long-term approach. Wrapping the assertions does indeed seem like a cleaner and less speculative direction, and I would be glad to revisit and refine this in a follow-up. |
* ObjectSizerJUnitTest (cherry picked from commit e82209b)
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
Has your PR been rebased against the latest commit within the target branch (typically
develop)?Is your initial contribution a single, squashed commit?
Does
gradlew buildrun cleanly?Have you written or updated unit tests to verify your changes?
If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?