[web] Remove the benchmarks of the HTML renderer (#158520)
As the title says, this PR deletes the HTML renderer's benchmarks.
This commit is contained in:
parent
0e2d55e0e7
commit
09941e7b47
17
.ci.yaml
17
.ci.yaml
@ -1541,23 +1541,6 @@ targets:
|
|||||||
["devicelab","hostonly", "linux"]
|
["devicelab","hostonly", "linux"]
|
||||||
task_name: web_benchmarks_canvaskit
|
task_name: web_benchmarks_canvaskit
|
||||||
|
|
||||||
- name: Linux web_benchmarks_html
|
|
||||||
recipe: devicelab/devicelab_drone
|
|
||||||
timeout: 60
|
|
||||||
properties:
|
|
||||||
dependencies: >-
|
|
||||||
[
|
|
||||||
{"dependency": "android_sdk", "version": "version:35v1"},
|
|
||||||
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"}
|
|
||||||
]
|
|
||||||
tags: >
|
|
||||||
["devicelab"]
|
|
||||||
task_name: web_benchmarks_html
|
|
||||||
runIf:
|
|
||||||
- dev/**
|
|
||||||
- bin/**
|
|
||||||
- .ci.yaml
|
|
||||||
|
|
||||||
- name: Linux web_benchmarks_skwasm
|
- name: Linux web_benchmarks_skwasm
|
||||||
recipe: devicelab/devicelab_drone
|
recipe: devicelab/devicelab_drone
|
||||||
presubmit: false
|
presubmit: false
|
||||||
|
@ -290,7 +290,6 @@
|
|||||||
/dev/devicelab/bin/tasks/run_release_test_windows.dart @loic-sharma @flutter/tool
|
/dev/devicelab/bin/tasks/run_release_test_windows.dart @loic-sharma @flutter/tool
|
||||||
/dev/devicelab/bin/tasks/technical_debt__cost.dart @Piinks @flutter/framework
|
/dev/devicelab/bin/tasks/technical_debt__cost.dart @Piinks @flutter/framework
|
||||||
/dev/devicelab/bin/tasks/web_benchmarks_canvaskit.dart @yjbanov @flutter/web
|
/dev/devicelab/bin/tasks/web_benchmarks_canvaskit.dart @yjbanov @flutter/web
|
||||||
/dev/devicelab/bin/tasks/web_benchmarks_html.dart @yjbanov @flutter/web
|
|
||||||
/dev/devicelab/bin/tasks/web_benchmarks_skwasm.dart @eyebrowsoffire @flutter/web
|
/dev/devicelab/bin/tasks/web_benchmarks_skwasm.dart @eyebrowsoffire @flutter/web
|
||||||
/dev/devicelab/bin/tasks/web_benchmarks_skwasm_st.dart @eyebrowsoffire @flutter/web
|
/dev/devicelab/bin/tasks/web_benchmarks_skwasm_st.dart @eyebrowsoffire @flutter/web
|
||||||
/dev/devicelab/bin/tasks/windows_home_scroll_perf__timeline_summary.dart @jonahwilliams @flutter/engine
|
/dev/devicelab/bin/tasks/windows_home_scroll_perf__timeline_summary.dart @jonahwilliams @flutter/engine
|
||||||
|
@ -111,7 +111,7 @@ in `lib/web_benchmarks.dart`.
|
|||||||
### How to run a web benchmark
|
### How to run a web benchmark
|
||||||
|
|
||||||
Web benchmarks can be run using `flutter run` in debug, profile, and release
|
Web benchmarks can be run using `flutter run` in debug, profile, and release
|
||||||
modes, using either the HTML or the CanvasKit rendering backend. Note, however,
|
modes, using either the CanvasKit or the Skwasm rendering backend. Note, however,
|
||||||
that running in debug mode will result in worse numbers. Profile mode is useful
|
that running in debug mode will result in worse numbers. Profile mode is useful
|
||||||
for profiling in Chrome DevTools because the numbers are close to release mode
|
for profiling in Chrome DevTools because the numbers are close to release mode
|
||||||
and the profile contains unobfuscated names.
|
and the profile contains unobfuscated names.
|
||||||
@ -121,9 +121,6 @@ Example:
|
|||||||
```sh
|
```sh
|
||||||
cd dev/benchmarks/macrobenchmarks
|
cd dev/benchmarks/macrobenchmarks
|
||||||
|
|
||||||
# Runs in profile mode using the HTML renderer
|
|
||||||
flutter run --web-renderer=html --profile -d web-server lib/web_benchmarks.dart
|
|
||||||
|
|
||||||
# Runs in profile mode using the CanvasKit renderer
|
# Runs in profile mode using the CanvasKit renderer
|
||||||
flutter run --web-renderer=canvaskit --profile -d web-server lib/web_benchmarks.dart
|
flutter run --web-renderer=canvaskit --profile -d web-server lib/web_benchmarks.dart
|
||||||
```
|
```
|
||||||
@ -133,9 +130,6 @@ You can also run all benchmarks exactly as the devicelab runs them:
|
|||||||
```sh
|
```sh
|
||||||
cd dev/devicelab
|
cd dev/devicelab
|
||||||
|
|
||||||
# Runs using the HTML renderer
|
|
||||||
../../bin/cache/dart-sdk/bin/dart bin/run.dart -t bin/tasks/web_benchmarks_html.dart
|
|
||||||
|
|
||||||
# Runs using the CanvasKit renderer
|
# Runs using the CanvasKit renderer
|
||||||
../../bin/cache/dart-sdk/bin/dart bin/run.dart -t bin/tasks/web_benchmarks_canvaskit.dart
|
../../bin/cache/dart-sdk/bin/dart bin/run.dart -t bin/tasks/web_benchmarks_canvaskit.dart
|
||||||
```
|
```
|
||||||
|
@ -9,8 +9,7 @@ import 'recorder.dart';
|
|||||||
/// Repeatedly paints a grid of rectangles where each rectangle is drawn in its
|
/// Repeatedly paints a grid of rectangles where each rectangle is drawn in its
|
||||||
/// own [Picture].
|
/// own [Picture].
|
||||||
///
|
///
|
||||||
/// Measures the performance of updating many layers. For example, the HTML
|
/// Measures the performance of updating many layers.
|
||||||
/// rendering backend attempts to reuse the DOM nodes created for engine layers.
|
|
||||||
///
|
///
|
||||||
/// See also `bench_draw_rect.dart`, which draws nearly identical UI but puts all
|
/// See also `bench_draw_rect.dart`, which draws nearly identical UI but puts all
|
||||||
/// rectangles into the same picture.
|
/// rectangles into the same picture.
|
||||||
|
@ -18,10 +18,6 @@ import 'recorder.dart';
|
|||||||
// WASM codecs execute on the main thread and block the UI, leading to jank,
|
// WASM codecs execute on the main thread and block the UI, leading to jank,
|
||||||
// but the browser's WebCodecs API is asynchronous running on a separate thread
|
// but the browser's WebCodecs API is asynchronous running on a separate thread
|
||||||
// and does not jank. However, the benchmark result may be the same.
|
// and does not jank. However, the benchmark result may be the same.
|
||||||
//
|
|
||||||
// This benchmark does not support the HTML renderer because the HTML renderer
|
|
||||||
// cannot decode image frames (it always returns 1 dummy frame, even for
|
|
||||||
// animated images).
|
|
||||||
class BenchImageDecoding extends RawRecorder {
|
class BenchImageDecoding extends RawRecorder {
|
||||||
BenchImageDecoding() : super(
|
BenchImageDecoding() : super(
|
||||||
name: benchmarkName,
|
name: benchmarkName,
|
||||||
|
@ -45,27 +45,13 @@ class ParagraphGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Which mode to run [BenchBuildColorsGrid] in.
|
|
||||||
enum _TestMode {
|
|
||||||
/// Uses the HTML rendering backend with the canvas 2D text layout.
|
|
||||||
useCanvasTextLayout,
|
|
||||||
|
|
||||||
/// Uses CanvasKit for everything.
|
|
||||||
useCanvasKit,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Repeatedly lays out a paragraph.
|
/// Repeatedly lays out a paragraph.
|
||||||
///
|
///
|
||||||
/// Creates a different paragraph each time in order to avoid hitting the cache.
|
/// Creates a different paragraph each time in order to avoid hitting the cache.
|
||||||
class BenchTextLayout extends RawRecorder {
|
class BenchTextLayout extends RawRecorder {
|
||||||
BenchTextLayout.canvas()
|
BenchTextLayout() : super(name: benchmarkName);
|
||||||
: super(name: canvasBenchmarkName);
|
|
||||||
|
|
||||||
BenchTextLayout.canvasKit()
|
static const String benchmarkName = 'text_canvaskit_layout';
|
||||||
: super(name: canvasKitBenchmarkName);
|
|
||||||
|
|
||||||
static const String canvasBenchmarkName = 'text_canvas_layout';
|
|
||||||
static const String canvasKitBenchmarkName = 'text_canvaskit_layout';
|
|
||||||
|
|
||||||
final ParagraphGenerator generator = ParagraphGenerator();
|
final ParagraphGenerator generator = ParagraphGenerator();
|
||||||
|
|
||||||
@ -143,14 +129,9 @@ class BenchTextLayout extends RawRecorder {
|
|||||||
/// use the same paragraph instance because the layout method will shortcircuit
|
/// use the same paragraph instance because the layout method will shortcircuit
|
||||||
/// in that case.
|
/// in that case.
|
||||||
class BenchTextCachedLayout extends RawRecorder {
|
class BenchTextCachedLayout extends RawRecorder {
|
||||||
BenchTextCachedLayout.canvas()
|
BenchTextCachedLayout() : super(name: benchmarkName);
|
||||||
: super(name: canvasBenchmarkName);
|
|
||||||
|
|
||||||
BenchTextCachedLayout.canvasKit()
|
static const String benchmarkName = 'text_canvas_kit_cached_layout';
|
||||||
: super(name: canvasKitBenchmarkName);
|
|
||||||
|
|
||||||
static const String canvasBenchmarkName = 'text_canvas_cached_layout';
|
|
||||||
static const String canvasKitBenchmarkName = 'text_canvas_kit_cached_layout';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void body(Profile profile) {
|
void body(Profile profile) {
|
||||||
@ -179,11 +160,7 @@ int _counter = 0;
|
|||||||
/// The benchmark constructs a tabbed view, where each tab displays a list of
|
/// The benchmark constructs a tabbed view, where each tab displays a list of
|
||||||
/// colors. Each color's description is made of several [Text] nodes.
|
/// colors. Each color's description is made of several [Text] nodes.
|
||||||
class BenchBuildColorsGrid extends WidgetBuildRecorder {
|
class BenchBuildColorsGrid extends WidgetBuildRecorder {
|
||||||
BenchBuildColorsGrid.canvas()
|
BenchBuildColorsGrid() : super(name: benchmarkName);
|
||||||
: _mode = _TestMode.useCanvasTextLayout, super(name: canvasBenchmarkName);
|
|
||||||
|
|
||||||
BenchBuildColorsGrid.canvasKit()
|
|
||||||
: _mode = _TestMode.useCanvasKit, super(name: canvasKitBenchmarkName);
|
|
||||||
|
|
||||||
/// Disables tracing for this benchmark.
|
/// Disables tracing for this benchmark.
|
||||||
///
|
///
|
||||||
@ -193,47 +170,7 @@ class BenchBuildColorsGrid extends WidgetBuildRecorder {
|
|||||||
@override
|
@override
|
||||||
bool get isTracingEnabled => false;
|
bool get isTracingEnabled => false;
|
||||||
|
|
||||||
static const String canvasBenchmarkName = 'text_canvas_color_grid';
|
static const String benchmarkName = 'text_canvas_kit_color_grid';
|
||||||
static const String canvasKitBenchmarkName = 'text_canvas_kit_color_grid';
|
|
||||||
|
|
||||||
/// Whether to use the new canvas-based text measurement implementation.
|
|
||||||
final _TestMode _mode;
|
|
||||||
|
|
||||||
num _textLayoutMicros = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setUpAll() async {
|
|
||||||
super.setUpAll();
|
|
||||||
registerEngineBenchmarkValueListener('text_layout', (num value) {
|
|
||||||
_textLayoutMicros += value;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> tearDownAll() async {
|
|
||||||
stopListeningToEngineBenchmarkValues('text_layout');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void frameWillDraw() {
|
|
||||||
super.frameWillDraw();
|
|
||||||
_textLayoutMicros = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void frameDidDraw() {
|
|
||||||
// We need to do this before calling [super.frameDidDraw] because the latter
|
|
||||||
// updates the value of [showWidget] in preparation for the next frame.
|
|
||||||
// TODO(yjbanov): https://github.com/flutter/flutter/issues/53877
|
|
||||||
if (showWidget && _mode != _TestMode.useCanvasKit) {
|
|
||||||
profile!.addDataPoint(
|
|
||||||
'text_layout',
|
|
||||||
Duration(microseconds: _textLayoutMicros.toInt()),
|
|
||||||
reported: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
super.frameDidDraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget createWidget() {
|
Widget createWidget() {
|
||||||
|
@ -36,8 +36,8 @@ const int kDefaultTotalSampleCount = _kDefaultWarmUpSampleCount + _kDefaultMeasu
|
|||||||
|
|
||||||
/// A benchmark metric that includes frame-related computations prior to
|
/// A benchmark metric that includes frame-related computations prior to
|
||||||
/// submitting layer and picture operations to the underlying renderer, such as
|
/// submitting layer and picture operations to the underlying renderer, such as
|
||||||
/// HTML and CanvasKit. During this phase we compute transforms, clips, and
|
/// CanvasKit. During this phase we compute transforms, clips, and other
|
||||||
/// other information needed for rendering.
|
/// information needed for rendering.
|
||||||
const String kProfilePrerollFrame = 'preroll_frame';
|
const String kProfilePrerollFrame = 'preroll_frame';
|
||||||
|
|
||||||
/// A benchmark metric that includes submitting layer and picture information
|
/// A benchmark metric that includes submitting layer and picture information
|
||||||
|
@ -36,7 +36,6 @@ import 'src/web/recorder.dart';
|
|||||||
|
|
||||||
typedef RecorderFactory = Recorder Function();
|
typedef RecorderFactory = Recorder Function();
|
||||||
|
|
||||||
const bool isCanvasKit = bool.fromEnvironment('FLUTTER_WEB_USE_SKIA');
|
|
||||||
const bool isSkwasm = bool.fromEnvironment('FLUTTER_WEB_USE_SKWASM');
|
const bool isSkwasm = bool.fromEnvironment('FLUTTER_WEB_USE_SKWASM');
|
||||||
|
|
||||||
/// List of all benchmarks that run in the devicelab.
|
/// List of all benchmarks that run in the devicelab.
|
||||||
@ -80,24 +79,11 @@ final Map<String, RecorderFactory> benchmarks = <String, RecorderFactory>{
|
|||||||
BenchMaterial3Semantics.benchmarkName: () => BenchMaterial3Semantics(),
|
BenchMaterial3Semantics.benchmarkName: () => BenchMaterial3Semantics(),
|
||||||
BenchMaterial3ScrollSemantics.benchmarkName: () => BenchMaterial3ScrollSemantics(),
|
BenchMaterial3ScrollSemantics.benchmarkName: () => BenchMaterial3ScrollSemantics(),
|
||||||
|
|
||||||
// Skia-only benchmarks
|
BenchTextLayout.benchmarkName: () => BenchTextLayout(),
|
||||||
if (isCanvasKit || isSkwasm) ...<String, RecorderFactory>{
|
BenchBuildColorsGrid.benchmarkName: () => BenchBuildColorsGrid(),
|
||||||
BenchTextLayout.canvasKitBenchmarkName: () => BenchTextLayout.canvasKit(),
|
BenchTextCachedLayout.benchmarkName: () => BenchTextCachedLayout(),
|
||||||
BenchBuildColorsGrid.canvasKitBenchmarkName: () => BenchBuildColorsGrid.canvasKit(),
|
|
||||||
BenchTextCachedLayout.canvasKitBenchmarkName: () => BenchTextCachedLayout.canvasKit(),
|
|
||||||
|
|
||||||
// The HTML renderer does not decode frame-by-frame. It just drops an <img>
|
BenchImageDecoding.benchmarkName: () => BenchImageDecoding(),
|
||||||
// element and lets it animate automatically with no feedback to the
|
|
||||||
// framework. So this benchmark only makes sense in CanvasKit.
|
|
||||||
BenchImageDecoding.benchmarkName: () => BenchImageDecoding(),
|
|
||||||
},
|
|
||||||
|
|
||||||
// HTML-only benchmarks
|
|
||||||
if (!isCanvasKit && !isSkwasm) ...<String, RecorderFactory>{
|
|
||||||
BenchTextLayout.canvasBenchmarkName: () => BenchTextLayout.canvas(),
|
|
||||||
BenchTextCachedLayout.canvasBenchmarkName: () => BenchTextCachedLayout.canvas(),
|
|
||||||
BenchBuildColorsGrid.canvasBenchmarkName: () => BenchBuildColorsGrid.canvas(),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final LocalBenchmarkServerClient _client = LocalBenchmarkServerClient();
|
final LocalBenchmarkServerClient _client = LocalBenchmarkServerClient();
|
||||||
|
@ -9,7 +9,6 @@ import 'package:flutter_devicelab/tasks/web_benchmarks.dart';
|
|||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
await task(() async {
|
await task(() async {
|
||||||
return runWebBenchmark((
|
return runWebBenchmark((
|
||||||
webRenderer: 'canvaskit',
|
|
||||||
useWasm: false,
|
useWasm: false,
|
||||||
forceSingleThreadedSkwasm: false,
|
forceSingleThreadedSkwasm: false,
|
||||||
));
|
));
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright 2014 The Flutter 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:flutter_devicelab/framework/framework.dart';
|
|
||||||
import 'package:flutter_devicelab/tasks/web_benchmarks.dart';
|
|
||||||
|
|
||||||
/// Runs all Web benchmarks using the HTML rendering backend.
|
|
||||||
Future<void> main() async {
|
|
||||||
await task(() async {
|
|
||||||
return runWebBenchmark((
|
|
||||||
webRenderer: 'html',
|
|
||||||
useWasm: false,
|
|
||||||
forceSingleThreadedSkwasm: false,
|
|
||||||
));
|
|
||||||
});
|
|
||||||
}
|
|
@ -9,7 +9,6 @@ import 'package:flutter_devicelab/tasks/web_benchmarks.dart';
|
|||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
await task(() async {
|
await task(() async {
|
||||||
return runWebBenchmark((
|
return runWebBenchmark((
|
||||||
webRenderer: 'skwasm',
|
|
||||||
useWasm: true,
|
useWasm: true,
|
||||||
forceSingleThreadedSkwasm: false,
|
forceSingleThreadedSkwasm: false,
|
||||||
));
|
));
|
||||||
|
@ -9,7 +9,6 @@ import 'package:flutter_devicelab/tasks/web_benchmarks.dart';
|
|||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
await task(() async {
|
await task(() async {
|
||||||
return runWebBenchmark((
|
return runWebBenchmark((
|
||||||
webRenderer: 'skwasm',
|
|
||||||
useWasm: true,
|
useWasm: true,
|
||||||
forceSingleThreadedSkwasm: true,
|
forceSingleThreadedSkwasm: true,
|
||||||
));
|
));
|
||||||
|
@ -21,7 +21,6 @@ const int benchmarkServerPort = 9999;
|
|||||||
const int chromeDebugPort = 10000;
|
const int chromeDebugPort = 10000;
|
||||||
|
|
||||||
typedef WebBenchmarkOptions = ({
|
typedef WebBenchmarkOptions = ({
|
||||||
String webRenderer,
|
|
||||||
bool useWasm,
|
bool useWasm,
|
||||||
bool forceSingleThreadedSkwasm,
|
bool forceSingleThreadedSkwasm,
|
||||||
});
|
});
|
||||||
@ -41,7 +40,6 @@ Future<TaskResult> runWebBenchmark(WebBenchmarkOptions benchmarkOptions) async {
|
|||||||
'--no-strip-wasm',
|
'--no-strip-wasm',
|
||||||
],
|
],
|
||||||
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true',
|
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true',
|
||||||
if (!benchmarkOptions.useWasm) '--web-renderer=${benchmarkOptions.webRenderer}',
|
|
||||||
'--profile',
|
'--profile',
|
||||||
'--no-web-resources-cdn',
|
'--no-web-resources-cdn',
|
||||||
'-t',
|
'-t',
|
||||||
@ -175,10 +173,10 @@ Future<TaskResult> runWebBenchmark(WebBenchmarkOptions benchmarkOptions) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String webRendererName;
|
final String webRendererName;
|
||||||
if (benchmarkOptions.useWasm && benchmarkOptions.forceSingleThreadedSkwasm) {
|
if (benchmarkOptions.useWasm) {
|
||||||
webRendererName = 'skwasm_st';
|
webRendererName = benchmarkOptions.forceSingleThreadedSkwasm ? 'skwasm_st' : 'skwasm';
|
||||||
} else {
|
} else {
|
||||||
webRendererName = benchmarkOptions.webRenderer;
|
webRendererName = 'canvaskit';
|
||||||
}
|
}
|
||||||
final String namespace = '$benchmarkName.$webRendererName';
|
final String namespace = '$benchmarkName.$webRendererName';
|
||||||
final List<String> scoreKeys = List<String>.from(profile['scoreKeys'] as List<dynamic>);
|
final List<String> scoreKeys = List<String>.from(profile['scoreKeys'] as List<dynamic>);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user