文件最后提交记录最后更新时间
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
[web_benchmarks] Report correct expected metrics for wasm (#10236) Depends on https://github.com/flutter/flutter/commit/2e51c3f343fb70a14bfd1331af22f88ecc952818 which will be part of the 3.38.0 release. Fixes https://github.com/flutter/flutter/issues/1770576 个月前
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
[web_benchmarks] Report correct expected metrics for wasm (#10236) Depends on https://github.com/flutter/flutter/commit/2e51c3f343fb70a14bfd1331af22f88ecc952818 which will be part of the 3.38.0 release. Fixes https://github.com/flutter/flutter/issues/1770576 个月前
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
Replace initialPage parameter with benchmarkPath (#7743) This will unblock https://github.com/flutter/devtools/pull/8320. This is a follow up to the initial attempt here: https://github.com/flutter/packages/pull/76321 年前
Standardize copyright author and year (#338) Standardize copyright author ("The Flutter Authors") and year (2013), as was previously done in flutter/plugins. Adds per-package AUTHORS files to ensure that published packages contain the authorship information referred to in the boilerplate (again, as in flutter/plugins). First preparatory step in enabling the automated license format check in this repository.4 年前
[web_benchmarks] Report correct expected metrics for wasm (#10236) Depends on https://github.com/flutter/flutter/commit/2e51c3f343fb70a14bfd1331af22f88ecc952818 which will be part of the 3.38.0 release. Fixes https://github.com/flutter/flutter/issues/1770576 个月前
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
Update repo for 3.35 stable release (#9816) Does the steps listed at https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.35 release. This makes the minimum supported version for all packages Dart 3.7, which means it picks up the new formatter. As a result, there are massive amounts of code changes; all of it is just the result of running dart format after changing the min SDK version.9 个月前
[web_benchmarks] Report correct expected metrics for wasm (#10236) Depends on https://github.com/flutter/flutter/commit/2e51c3f343fb70a14bfd1331af22f88ecc952818 which will be part of the 3.38.0 release. Fixes https://github.com/flutter/flutter/issues/1770576 个月前
README.md

web_benchmarks

A benchmark harness for Flutter Web apps. Currently only supports running benchmarks in Chrome.

Writing a benchmark

An example benchmark can be found in testing/test_app/benchmark/web_benchmark_test.dart.

A web benchmark is made of two parts: a client and a server. The client is code that runs in the browser together with the benchmark code. The server serves the app's code and assets. Additionally, the server communicates with the browser to extract the performance traces.

Analyzing benchmark results

After running web benchmarks, you may want to analyze the results or compare with the results from other benchmark runs. The web_benchmarks package supports the following analysis operations:

  • compute the delta between two benchmark results
  • compute the average of a set of benchmark results
import 'dart:convert';
import 'dart:io';

import 'package:web_benchmarks/analysis.dart';

void main() {
  final BenchmarkResults baselineResults = _benchmarkResultsFromFile(
    '/path/to/benchmark_baseline.json',
  );
  final BenchmarkResults testResults1 = _benchmarkResultsFromFile(
    '/path/to/benchmark_test_1.json',
  );
  final BenchmarkResults testResults2 = _benchmarkResultsFromFile(
    '/path/to/benchmark_test_2.json',
  );

  // Compute the delta between [baselineResults] and [testResults1].
  final BenchmarkResults delta = computeDelta(baselineResults, testResults1);
  stdout.writeln(delta.toJson());

  // Compute the average of [testResults] and [testResults2].
  final BenchmarkResults average = computeAverage(<BenchmarkResults>[
    testResults1,
    testResults2,
  ]);
  stdout.writeln(average.toJson());
}

BenchmarkResults _benchmarkResultsFromFile(String path) {
  final File file = File.fromUri(Uri.parse(path));
  final Map<String, Object?> fileContentAsJson =
      jsonDecode(file.readAsStringSync()) as Map<String, Object?>;
  return BenchmarkResults.parse(fileContentAsJson);
}