New benchmark: Gesture semantics (#35232)

* Add semanticsEnabled to widgetBenchmark
* Add button_matrix_app and gesture benchmark
diff --git a/dev/benchmarks/microbenchmarks/README.md b/dev/benchmarks/microbenchmarks/README.md
index 7174a5d..eda8bae 100644
--- a/dev/benchmarks/microbenchmarks/README.md
+++ b/dev/benchmarks/microbenchmarks/README.md
@@ -6,6 +6,7 @@
 
 ```
 flutter run --release lib/gestures/velocity_tracker_data.dart
+flutter run --release lib/gestures/gesture_detector_bench.dart
 flutter run --release lib/stocks/animation_bench.dart
 flutter run --release lib/stocks/build_bench.dart
 flutter run --release lib/stocks/layout_bench.dart
diff --git a/dev/benchmarks/microbenchmarks/lib/gestures/apps/button_matrix_app.dart b/dev/benchmarks/microbenchmarks/lib/gestures/apps/button_matrix_app.dart
new file mode 100644
index 0000000..1069ef9
--- /dev/null
+++ b/dev/benchmarks/microbenchmarks/lib/gestures/apps/button_matrix_app.dart
@@ -0,0 +1,52 @@
+// Copyright 2019 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/material.dart';
+
+class ButtonMatrixApp extends StatefulWidget {
+  @override
+  ButtonMatrixAppState createState() => ButtonMatrixAppState();
+}
+
+class ButtonMatrixAppState extends State<ButtonMatrixApp> {
+
+  int count = 1;
+  int increment = 1;
+
+  @override
+  Widget build(BuildContext context) {
+    return MaterialApp(
+      home: Scaffold(
+        appBar: AppBar(
+          title: Text('Count: $count'),
+          actions: <Widget>[
+            FlatButton(
+              onPressed: () => setState(() { count += increment; }),
+              child: Text('Add $increment'),
+            ),
+          ],
+        ),
+        body: Row(
+          mainAxisAlignment: MainAxisAlignment.center,
+          children: List<Widget>.filled(
+            3,
+            Column(
+              children: List<Widget>.filled(
+                10,
+                FlatButton(
+                  child: const Text('Faster'),
+                  onPressed: () => setState(() { increment += 1; }),
+                ),
+              ),
+            ),
+          ),
+        ),
+      ),
+    );
+  }
+}
+
+void main() {
+  runApp(ButtonMatrixApp());
+}
diff --git a/dev/benchmarks/microbenchmarks/lib/gestures/gesture_detector_bench.dart b/dev/benchmarks/microbenchmarks/lib/gestures/gesture_detector_bench.dart
new file mode 100644
index 0000000..eba8b80
--- /dev/null
+++ b/dev/benchmarks/microbenchmarks/lib/gestures/gesture_detector_bench.dart
@@ -0,0 +1,52 @@
+// Copyright 2019 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/gestures.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import '../common.dart';
+import './apps/button_matrix_app.dart' as button_matrix;
+
+const int _kNumWarmUpIters = 20;
+const int _kNumIters = 300;
+
+Future<void> main() async {
+  assert(false, "Don't run benchmarks in checked mode! Use 'flutter run --release'.");
+  final Stopwatch watch = Stopwatch();
+  print('GestureDetector semantics benchmark...');
+
+  await benchmarkWidgets((WidgetTester tester) async {
+    button_matrix.main();
+    await tester.pump();
+    await tester.pump(const Duration(seconds: 1));
+
+    Future<void> iter() async {
+      // Press a button to update the screen
+      await tester.tapAt(const Offset(760.0, 30.0));
+      await tester.pump();
+    }
+
+    // Warm up runs get the app into steady state, making benchmark
+    // results more credible
+    for (int i = 0; i < _kNumWarmUpIters; i += 1) {
+      await iter();
+    }
+    await tester.pumpAndSettle();
+
+    watch.start();
+    for (int i = 0; i < _kNumIters; i += 1) {
+      await iter();
+    }
+    watch.stop();
+  }, semanticsEnabled: true);
+
+  final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
+  printer.addResult(
+    description: 'GestureDetector',
+    value: watch.elapsedMicroseconds / _kNumIters,
+    unit: 'µs per iteration',
+    name: 'gesture_detector_bench',
+  );
+  printer.printToStdout();
+}
diff --git a/dev/devicelab/lib/tasks/microbenchmarks.dart b/dev/devicelab/lib/tasks/microbenchmarks.dart
index 2436c76..e3c3f35 100644
--- a/dev/devicelab/lib/tasks/microbenchmarks.dart
+++ b/dev/devicelab/lib/tasks/microbenchmarks.dart
@@ -53,6 +53,7 @@
     allResults.addAll(await _runMicrobench('lib/stocks/build_bench.dart'));
     allResults.addAll(await _runMicrobench('lib/geometry/rrect_contains_bench.dart'));
     allResults.addAll(await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'));
+    allResults.addAll(await _runMicrobench('lib/gestures/gesture_detector_bench.dart'));
     allResults.addAll(await _runMicrobench('lib/stocks/animation_bench.dart'));
 
     return TaskResult.success(allResults, benchmarkScoreKeys: allResults.keys.toList());