Languages
[Edit]
EN

CPU Benchmark - single core speed test with Fibonacci Sequence in Dart

7 points
Created by:
Gigadude
791

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

  1. CPU Benchmark - Raspberry PI vs Banana PI - single core speed test with Fibonacci Sequence

  2. CPU Benchmark - single core speed test with Fibonacci Sequence in JavaScript

  3. CPU Benchmark - single core speed test with Fibonacci Sequence in Java

  4. CPU Benchmark - single core speed test with Fibonacci Sequence in AssemblyScript

  5. CPU Benchmark - single core speed test with Fibonacci Sequence in Python

  6. CPU Benchmark - single core speed test with Fibonacci Sequence in PHP

Online runners

  1. https://dartpad.dev

References

  1. Install the Dart SDK using a package manager
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join