From 6cf6171b35ebc644ef91e829c3f04e00ebd4344b Mon Sep 17 00:00:00 2001 From: Krille-chan Date: Fri, 6 Jun 2025 13:45:13 +0200 Subject: [PATCH] refactor: disable benchmarks by global boolean (#2104) Benchmarks are flooding the logs. We should disable them by default and allow having low debug level at the same time. --- lib/src/utils/run_benchmarked.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/utils/run_benchmarked.dart b/lib/src/utils/run_benchmarked.dart index af5a85bf..98a696fe 100644 --- a/lib/src/utils/run_benchmarked.dart +++ b/lib/src/utils/run_benchmarked.dart @@ -18,6 +18,8 @@ import 'package:matrix/matrix.dart'; +var kEnableMatrixSdkBenchmarks = false; + /// Calculates some benchmarks for this function. Give it a [name] and a [func] /// to call and it will calculate the needed milliseconds. Give it an optional /// [itemCount] to let it also calculate the needed milliseconds per item. @@ -26,7 +28,7 @@ Future runBenchmarked( Future Function() func, [ int? itemCount, ]) async { - if (Logs().level.index < Level.debug.index) { + if (!kEnableMatrixSdkBenchmarks) { return func(); } final start = DateTime.now();