CPU Benchmark - single core speed test with Fibonacci Sequence in Dart
In this short article, I would like to show Fibonacci Sequence test that is run on a single core. The test source code was converted from C++ to Dart - check source article.
Example test.dart
file:
void main() {
int tmp, a = 0, b = 1;
print('Started!');
var t1 = DateTime.now();
for (int i = 0; i < 10000; ++i) {
for (int j = 0; j < 1000000; ++j) {
tmp = b;
b = a + b;
a = tmp;
}
}
var t2 = DateTime.now();
var dt = t2.millisecondsSinceEpoch - t1.millisecondsSinceEpoch;
print('Finished!');
print('Result: ${b}');
print('Time: ${dt}s');
}
Test compilation:
dart compile exe test.dart
Test running:
./test.exe
Example output:
Started!
Finished!
Result: -1667179358074339043
Time: 4.3180000000000005s
Note:
Result: -1667179358074339043
was printed only to prevent against automiatic optimization.
Used Dart SDK: 3.3.2 (stable) (None) on "linux_x64"
Used OS: Ubuntu 23.10 x64
Used PC:
- Ryzen 9 5900x
- DRR 4 (2x 32GB)
- Samsung SSD M.2 970 EVO (1TB)
- AMD Radeon RX 6700 XT (12GB RAM)
See also
-
CPU Benchmark - Raspberry PI vs Banana PI - single core speed test with Fibonacci Sequence
-
CPU Benchmark - single core speed test with Fibonacci Sequence in JavaScript
-
CPU Benchmark - single core speed test with Fibonacci Sequence in Java
-
CPU Benchmark - single core speed test with Fibonacci Sequence in AssemblyScript
-
CPU Benchmark - single core speed test with Fibonacci Sequence in Python
-
CPU Benchmark - single core speed test with Fibonacci Sequence in PHP