Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/16196#discussion_r91375333
--- Diff: core/src/main/scala/org/apache/spark/util/SizeEstimator.scala ---
@@ -316,62 +338,40 @@ object SizeEstimator extends Logging {
*/
private def getClassInfo(cls: Class[_]): ClassInfo = {
// Check whether we've already cached a ClassInfo for this class
- val info = classInfos.get(cls)
+ val info = classInfos.get().get(cls)
if (info != null) {
return info
}
val parent = getClassInfo(cls.getSuperclass)
+ val fields = cls.getDeclaredFields
+ val fieldCount = fields.length
var shellSize = parent.shellSize
- var pointerFields = parent.pointerFields
- val sizeCount = Array.fill(fieldSizes.max + 1)(0)
+ var fieldOffsets = parent.fieldOffsets.toList
+
+ var index = 0
- // iterate through the fields of this class and gather information.
- for (field <- cls.getDeclaredFields) {
+ while (index < fieldCount) {
+ val field = fields(index)
if (!Modifier.isStatic(field.getModifiers)) {
val fieldClass = field.getType
if (fieldClass.isPrimitive) {
- sizeCount(primitiveSize(fieldClass)) += 1
+ if (cls == classOf[Double] || cls == classOf[Long]) {
--- End diff --
This and the logic changes below aren't obviously OK. this seems to lose a
lot of logic. I think this has to be explained or backed out
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]