-
Enhancement
-
Resolution: Unresolved
-
P4
-
8
From Richard's mail:
Recomputing the same values between layout runs
final double snaphgap = snapSpace(getHgap());
final double snapvgap = snapSpace(getVgap());
final double top = snapSpace(getInsets().getTop());
final double bottom = snapSpace(getInsets().getBottom());
final double left = snapSpace(getInsets().getLeft());
final double right = snapSpace(getInsets().getRight());
These for example, almost never change. The hgap and vgap rarely change, they're usually only set once. The Insets also are very rarely ever changed. Yet ever time we layoutChildren (and probably in other places throughout the class), we recompute the snapspace value for these. So we have the getter (or two), the snapSpace method call, which then calls snapSpace(d, isSnapToPixel()) which then calls Math.round. So there are a lot of method calls here.
It seems like, for these properties, we could have a call field defined that contains the snapSpace equivalent, so that we don't have to do these calls over and over again.
Recomputing the same values between layout runs
final double snaphgap = snapSpace(getHgap());
final double snapvgap = snapSpace(getVgap());
final double top = snapSpace(getInsets().getTop());
final double bottom = snapSpace(getInsets().getBottom());
final double left = snapSpace(getInsets().getLeft());
final double right = snapSpace(getInsets().getRight());
These for example, almost never change. The hgap and vgap rarely change, they're usually only set once. The Insets also are very rarely ever changed. Yet ever time we layoutChildren (and probably in other places throughout the class), we recompute the snapspace value for these. So we have the getter (or two), the snapSpace method call, which then calls snapSpace(d, isSnapToPixel()) which then calls Math.round. So there are a lot of method calls here.
It seems like, for these properties, we could have a call field defined that contains the snapSpace equivalent, so that we don't have to do these calls over and over again.
- blocks
-
JDK-8092409 Performance optimizations for layouts
- Open