Add strip markdown benchmark

This commit is contained in:
Vishesh Handa
2020-02-17 15:49:12 +01:00
parent 9f2fa7c3e4
commit 17fd25cac9
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,38 @@
// Import BenchmarkBase class.
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:gitjournal/utils/markdown.dart';
// Create a new benchmark by extending BenchmarkBase
class StripMarkdownBenchmark extends BenchmarkBase {
const StripMarkdownBenchmark() : super('StripMarkdown');
static void main() {
const StripMarkdownBenchmark().report();
}
// The benchmark code.
@override
void run() {
var input = """Itemized lists
look like:
* this one
* that one
""";
stripMarkdownFormatting(input);
}
// Not measured setup code executed prior to the benchmark runs.
@override
void setup() {}
// Not measured teardown code executed after the benchmark runs.
@override
void teardown() {}
}
void main() {
// Run StripMarkdownBenchmark
StripMarkdownBenchmark.main();
}

View File

@ -50,6 +50,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.6"
benchmark_harness:
dependency: "direct dev"
description:
name: benchmark_harness
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
boolean_selector:
dependency: transitive
description:

View File

@ -45,6 +45,7 @@ dev_dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
benchmark_harness: any
flutter:
uses-material-design: true