Github user advancedxy commented on a diff in the pull request: https://github.com/apache/spark/pull/4783#discussion_r26209062 --- Diff: core/src/main/scala/org/apache/spark/util/SizeEstimator.scala --- @@ -279,8 +315,8 @@ private[spark] object SizeEstimator extends Logging { newInfo } - private def alignSize(size: Long): Long = { - val rem = size % ALIGN_SIZE - if (rem == 0) size else (size + ALIGN_SIZE - rem) - } + private def alignSize(size: Long): Long = alignSizeUp(size, ALIGN_SIZE) + + private def alignSizeUp(size: Long, alignSize: Int): Long = + (size + alignSize - 1) & ~(alignSize - 1) --- End diff -- I noticed this code when I looked at the HotSpot JVM classloader code. It's a c macro. And I think it's quite elegant. So I ported this computation. I will add some comment if needed.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org