Skip to content

Instantly share code, notes, and snippets.

@IslamRustamov
Created June 7, 2023 20:11
Show Gist options
  • Save IslamRustamov/e48a7739585d9b3e1ccb0a8a436b4a2f to your computer and use it in GitHub Desktop.
Save IslamRustamov/e48a7739585d9b3e1ccb0a8a436b4a2f to your computer and use it in GitHub Desktop.
Future<void> _sort() async {
try {
double mean = 0;
for (var i = 0; i < 1000; i++) {
final stopwatch = Stopwatch()..start();
await platform.invokeMethod('sort', list10);
stopwatch.stop();
// Don't worry, I converted it to milliseconds afterwards
mean += stopwatch.elapsed.inMicroseconds;
stopwatch.reset();
}
print(mean / 1000);
} on PlatformException catch (e) {
print("error: '${e.message}'.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment