Revert "Shader warm up (#27660)" (#28376)

This reverts commit a44f174efc.

Reason: start_up tests become flaky.

See https://github.com/flutter/flutter/issues/28374

TBR: xster

Merge on red to fix the tree
This commit is contained in:
liyuqian
2019-02-22 17:32:37 -08:00
committed by GitHub
parent a44f174efc
commit adc8e159a5
15 changed files with 35 additions and 748 deletions

View File

@@ -1,40 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui';
import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter/painting.dart' show DefaultShaderWarmUp, PaintingBinding;
import 'package:macrobenchmarks/main.dart' as app;
class CubicBezierShaderWarmUp extends DefaultShaderWarmUp {
@override
void warmUpOnCanvas(Canvas canvas) {
super.warmUpOnCanvas(canvas);
// Warm up the cubic shaders used by CubicBezierPage.
//
// This tests that our custom shader warm up is working properly.
// Without this custom shader warm up, the worst frame time is about 115ms.
// With this, the worst frame time is about 70ms. (Data collected on a Moto
// G4 based on Flutter version 704814c67a874077710524d30412337884bf0254.
final Path path = Path();
path.moveTo(20.0, 20.0);
// This cubic path is based on
// https://skia.org/user/api/SkPath_Reference#SkPath_cubicTo
path.cubicTo(300.0, 80.0, -140.0, 90.0, 220.0, 10.0);
final Paint paint = Paint();
paint.isAntiAlias = true;
paint.strokeWidth = 18.0;
paint.style = PaintingStyle.stroke;
paint.strokeCap = StrokeCap.round;
canvas.drawPath(path, paint);
}
}
void main() {
PaintingBinding.shaderWarmUp = CubicBezierShaderWarmUp();
enableFlutterDriverExtension();
app.main();
}

View File

@@ -1,11 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:macrobenchmarks/common.dart';
import 'util.dart';
void main() {
macroPerfTest('cubic_bezier_perf', kCubicBezierRouteName);
}

View File

@@ -2,15 +2,42 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
import 'package:macrobenchmarks/common.dart';
import 'util.dart';
void main() {
macroPerfTest(
'cull_opacity_perf',
kCullOpacityRouteName,
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10)
);
const String kName = 'cull_opacity_perf';
test(kName, () async {
final FlutterDriver driver = await FlutterDriver.connect();
// The slight initial delay avoids starting the timing during a
// period of increased load on the device. Without this delay, the
// benchmark has greater noise.
// See: https://github.com/flutter/flutter/issues/19434
await Future<void>.delayed(const Duration(milliseconds: 250));
await driver.forceGC();
final SerializableFinder button = find.byValueKey(kCullOpacityRouteName);
expect(button, isNotNull);
await driver.tap(button);
// Wait for the page to load
await Future<void>.delayed(const Duration(seconds: 1));
final Timeline timeline = await driver.traceAction(() async {
await Future<void>.delayed(const Duration(seconds: 10));
});
final TimelineSummary summary = TimelineSummary.summarize(timeline);
summary.writeSummaryToFile(kName, pretty: true);
summary.writeTimelineToFile(kName, pretty: true);
driver.close();
});
}

View File

@@ -1,44 +0,0 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void macroPerfTest(
String testName,
String routeName,
{Duration pageDelay, Duration duration = const Duration(seconds: 3)}) {
test(testName, () async {
final FlutterDriver driver = await FlutterDriver.connect();
// The slight initial delay avoids starting the timing during a
// period of increased load on the device. Without this delay, the
// benchmark has greater noise.
// See: https://github.com/flutter/flutter/issues/19434
await Future<void>.delayed(const Duration(milliseconds: 250));
await driver.forceGC();
final SerializableFinder button = find.byValueKey(routeName);
expect(button, isNotNull);
await driver.tap(button);
if (pageDelay != null) {
// Wait for the page to load
await Future<void>.delayed(pageDelay);
}
final Timeline timeline = await driver.traceAction(() async {
await Future<void>.delayed(duration);
});
final TimelineSummary summary = TimelineSummary.summarize(timeline);
summary.writeSummaryToFile(testName, pretty: true);
summary.writeTimelineToFile(testName, pretty: true);
driver.close();
});
}