Skip to main content

Benchmarks

The packages that sit on a hot path have a benchmark suite. Its results are committed next to the code, as the baseline that every change is compared to. The pages of this section show those results as they are in the repository.

PackageWhat is measuredResults
crdt_lfevery handler, applying changes, snapshots, serialization, undo, …crdt_lf
hlc_dartclock operations and their encodinghlc_dart
crdt_lf_flutterthe text fields: typing, formats, remote edits, undocrdt_lf_flutter
crdt_lf_quillthe projection check of the Quill bindingcrdt_lf_quill

Reading the numbers​

  • Each row is the time of one run of the benchmark, in microseconds, milliseconds and seconds. Lower is better.
  • The name of a row says the size of the input: "on 10000 chars", "x1000". Compare rows of different sizes to see how a cost grows.
  • The numbers come from one developer machine. Read them as an order of magnitude, and to compare rows with each other, not as a promise for your device.
  • Results move by about ±10% from one run to the next. Compare two runs made on the same machine.

Run them yourself​

From the repository root:

melos run benchmark_dart # the pure Dart packages
melos run benchmark_flutter # the Flutter packages

From one package folder, run only some benchmark files (the name of a file in benchmarks/src/benchmarks/, without _benchmark.dart):

dart run benchmark_infrastructure:run_benchmarks --include=apply_changes
# Flutter packages: run_flutter_benchmarks, same flag

A run writes benchmarks/results.md in the package folder. A partial run rewrites only its own sections, so the file stays complete.