mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-23 15:22:43 +08:00
Add strip markdown benchmark
This commit is contained in:
38
benchmark/strip_markdown.dart
Normal file
38
benchmark/strip_markdown.dart
Normal 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();
|
||||
}
|
@ -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:
|
||||
|
@ -45,6 +45,7 @@ dev_dependencies:
|
||||
sdk: flutter
|
||||
flutter_driver:
|
||||
sdk: flutter
|
||||
benchmark_harness: any
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
Reference in New Issue
Block a user