diff --git a/benchmark/strip_markdown.dart b/benchmark/strip_markdown.dart new file mode 100644 index 00000000..e3e6a770 --- /dev/null +++ b/benchmark/strip_markdown.dart @@ -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(); +} diff --git a/pubspec.lock b/pubspec.lock index dbfe22c8..a7d2dd9d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index bc34ae95..e3ade4d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,6 +45,7 @@ dev_dependencies: sdk: flutter flutter_driver: sdk: flutter + benchmark_harness: any flutter: uses-material-design: true