提交 9accf81d 编写于 作者: A Adam Barth

Improve RenderNode performance

Experimenting with using the observatory profiler, I noticed two pieces of
low-hanging performance fruit. This change removes about 4% of the total
profile for layouting out and painting the flex demo.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1155043004
上级 1e9fc192
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
import '../node.dart';
import 'dart:math' as math;
import 'dart:sky' as sky;
class ParentData {
......@@ -22,21 +23,15 @@ double clamp({double min: 0.0, double value: 0.0, double max: double.INFINITY})
assert(min != null);
assert(value != null);
assert(max != null);
if (value > max)
value = max;
if (value < min)
value = min;
return value;
return math.max(min, math.min(max, value));
}
class RenderNodeDisplayList extends sky.PictureRecorder {
RenderNodeDisplayList(double width, double height) : super(width, height);
void paintChild(RenderNode child, sky.Point position) {
save();
translate(position.x, position.y);
child.paint(this);
restore();
translate(-position.x, -position.y);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册