[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:
Mouad Debbar 2024-11-15 11:24:20 -05:00 committed by GitHub
parent 0e2d55e0e7
commit 09941e7b47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 17 additions and 145 deletions

View File

@ -1541,23 +1541,6 @@ targets:
["devicelab","hostonly", "linux"]
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
recipe: devicelab/devicelab_drone
presubmit: false

View File

@ -290,7 +290,6 @@
/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/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_st.dart @eyebrowsoffire @flutter/web
/dev/devicelab/bin/tasks/windows_home_scroll_perf__timeline_summary.dart @jonahwilliams @flutter/engine

View File

@ -111,7 +111,7 @@ in `lib/web_benchmarks.dart`.
### How to run a web benchmark
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
for profiling in Chrome DevTools because the numbers are close to release mode
and the profile contains unobfuscated names.
@ -121,9 +121,6 @@ Example:
```sh
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
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
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
../../bin/cache/dart-sdk/bin/dart bin/run.dart -t bin/tasks/web_benchmarks_canvaskit.dart
```

View File

@ -9,8 +9,7 @@ import 'recorder.dart';
/// Repeatedly paints a grid of rectangles where each rectangle is drawn in its
/// own [Picture].
///
/// Measures the performance of updating many layers. For example, the HTML
/// rendering backend attempts to reuse the DOM nodes created for engine layers.
/// Measures the performance of updating many layers.
///
/// See also `bench_draw_rect.dart`, which draws nearly identical UI but puts all
/// rectangles into the same picture.

View File

@ -18,10 +18,6 @@ import 'recorder.dart';
// 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
// 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 {
BenchImageDecoding() : super(
name: benchmarkName,

View File

@ -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.
///
/// Creates a different paragraph each time in order to avoid hitting the cache.
class BenchTextLayout extends RawRecorder {
BenchTextLayout.canvas()
: super(name: canvasBenchmarkName);
BenchTextLayout() : super(name: benchmarkName);
BenchTextLayout.canvasKit()
: super(name: canvasKitBenchmarkName);
static const String canvasBenchmarkName = 'text_canvas_layout';
static const String canvasKitBenchmarkName = 'text_canvaskit_layout';
static const String benchmarkName = 'text_canvaskit_layout';
final ParagraphGenerator generator = ParagraphGenerator();
@ -143,14 +129,9 @@ class BenchTextLayout extends RawRecorder {
/// use the same paragraph instance because the layout method will shortcircuit
/// in that case.
class BenchTextCachedLayout extends RawRecorder {
BenchTextCachedLayout.canvas()
: super(name: canvasBenchmarkName);
BenchTextCachedLayout() : super(name: benchmarkName);
BenchTextCachedLayout.canvasKit()
: super(name: canvasKitBenchmarkName);
static const String canvasBenchmarkName = 'text_canvas_cached_layout';
static const String canvasKitBenchmarkName = 'text_canvas_kit_cached_layout';
static const String benchmarkName = 'text_canvas_kit_cached_layout';
@override
void body(Profile profile) {
@ -179,11 +160,7 @@ int _counter = 0;
/// The benchmark constructs a tabbed view, where each tab displays a list of
/// colors. Each color's description is made of several [Text] nodes.
class BenchBuildColorsGrid extends WidgetBuildRecorder {
BenchBuildColorsGrid.canvas()
: _mode = _TestMode.useCanvasTextLayout, super(name: canvasBenchmarkName);
BenchBuildColorsGrid.canvasKit()
: _mode = _TestMode.useCanvasKit, super(name: canvasKitBenchmarkName);
BenchBuildColorsGrid() : super(name: benchmarkName);
/// Disables tracing for this benchmark.
///
@ -193,47 +170,7 @@ class BenchBuildColorsGrid extends WidgetBuildRecorder {
@override
bool get isTracingEnabled => false;
static const String canvasBenchmarkName = 'text_canvas_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();
}
static const String benchmarkName = 'text_canvas_kit_color_grid';
@override
Widget createWidget() {

View File

@ -36,8 +36,8 @@ const int kDefaultTotalSampleCount = _kDefaultWarmUpSampleCount + _kDefaultMeasu
/// A benchmark metric that includes frame-related computations prior to
/// submitting layer and picture operations to the underlying renderer, such as
/// HTML and CanvasKit. During this phase we compute transforms, clips, and
/// other information needed for rendering.
/// CanvasKit. During this phase we compute transforms, clips, and other
/// information needed for rendering.
const String kProfilePrerollFrame = 'preroll_frame';
/// A benchmark metric that includes submitting layer and picture information

View File

@ -36,7 +36,6 @@ import 'src/web/recorder.dart';
typedef RecorderFactory = Recorder Function();
const bool isCanvasKit = bool.fromEnvironment('FLUTTER_WEB_USE_SKIA');
const bool isSkwasm = bool.fromEnvironment('FLUTTER_WEB_USE_SKWASM');
/// List of all benchmarks that run in the devicelab.
@ -80,24 +79,11 @@ final Map<String, RecorderFactory> benchmarks = <String, RecorderFactory>{
BenchMaterial3Semantics.benchmarkName: () => BenchMaterial3Semantics(),
BenchMaterial3ScrollSemantics.benchmarkName: () => BenchMaterial3ScrollSemantics(),
// Skia-only benchmarks
if (isCanvasKit || isSkwasm) ...<String, RecorderFactory>{
BenchTextLayout.canvasKitBenchmarkName: () => BenchTextLayout.canvasKit(),
BenchBuildColorsGrid.canvasKitBenchmarkName: () => BenchBuildColorsGrid.canvasKit(),
BenchTextCachedLayout.canvasKitBenchmarkName: () => BenchTextCachedLayout.canvasKit(),
BenchTextLayout.benchmarkName: () => BenchTextLayout(),
BenchBuildColorsGrid.benchmarkName: () => BenchBuildColorsGrid(),
BenchTextCachedLayout.benchmarkName: () => BenchTextCachedLayout(),
// The HTML renderer does not decode frame-by-frame. It just drops an <img>
// 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(),
},
BenchImageDecoding.benchmarkName: () => BenchImageDecoding(),
};
final LocalBenchmarkServerClient _client = LocalBenchmarkServerClient();

View File

@ -9,7 +9,6 @@ import 'package:flutter_devicelab/tasks/web_benchmarks.dart';
Future<void> main() async {
await task(() async {
return runWebBenchmark((
webRenderer: 'canvaskit',
useWasm: false,
forceSingleThreadedSkwasm: false,
));

View File

@ -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,
));
});
}

View File

@ -9,7 +9,6 @@ import 'package:flutter_devicelab/tasks/web_benchmarks.dart';
Future<void> main() async {
await task(() async {
return runWebBenchmark((
webRenderer: 'skwasm',
useWasm: true,
forceSingleThreadedSkwasm: false,
));

View File

@ -9,7 +9,6 @@ import 'package:flutter_devicelab/tasks/web_benchmarks.dart';
Future<void> main() async {
await task(() async {
return runWebBenchmark((
webRenderer: 'skwasm',
useWasm: true,
forceSingleThreadedSkwasm: true,
));

View File

@ -21,7 +21,6 @@ const int benchmarkServerPort = 9999;
const int chromeDebugPort = 10000;
typedef WebBenchmarkOptions = ({
String webRenderer,
bool useWasm,
bool forceSingleThreadedSkwasm,
});
@ -41,7 +40,6 @@ Future<TaskResult> runWebBenchmark(WebBenchmarkOptions benchmarkOptions) async {
'--no-strip-wasm',
],
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true',
if (!benchmarkOptions.useWasm) '--web-renderer=${benchmarkOptions.webRenderer}',
'--profile',
'--no-web-resources-cdn',
'-t',
@ -175,10 +173,10 @@ Future<TaskResult> runWebBenchmark(WebBenchmarkOptions benchmarkOptions) async {
}
final String webRendererName;
if (benchmarkOptions.useWasm && benchmarkOptions.forceSingleThreadedSkwasm) {
webRendererName = 'skwasm_st';
if (benchmarkOptions.useWasm) {
webRendererName = benchmarkOptions.forceSingleThreadedSkwasm ? 'skwasm_st' : 'skwasm';
} else {
webRendererName = benchmarkOptions.webRenderer;
webRendererName = 'canvaskit';
}
final String namespace = '$benchmarkName.$webRendererName';
final List<String> scoreKeys = List<String>.from(profile['scoreKeys'] as List<dynamic>);