phoenix
phoenix copied to clipboard
PHOENIX-4998 The estimated instance size of GuidePostsInfo doesn't co…
…unt the last update timestamp array.
@karanmehta93
It would be good to add a unit test for the size estimator function. We would know that we need to change how we estimate when we end up changing the data structure for storing these.
@karanmehta93, I thought about it, but I eventually gave up for the reasons listed below:
- If we wrote this unit test, the unit test would look like in two ways a. In unit test, check GuidePostsInfo.GetEstimatedSize() is equal to a constant value or a value calculated in the ways mentioned in https://dzone.com/articles/estimating-java-object-sizes or https://github.com/twitter/commons/blob/master/src/java/com/twitter/common/objectsize/ObjectSizeCalculator.java. The former is useless if the developer forgot to change "int estimatedSize = ..." in GuidePostsInfo's constructor, and the latter can only get an approximation of the object size. b. In unit test, list and check all the fields in GuidePostInfo are equal to what we have now. It seems overkilled and weird.
- We need to refactor GuidePostsInfo in the near future. I want to postpone how to calculate its object size and the unit test to that time.
Please let me know if you have better idea.
That makes sense. @BinShi-SecularBird
Those Java equivalents of sizeof() in C/C++, mentioned on the Web, might be overkilled here
Can you provide some details on this comment?