Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and add support for Null Safety #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Yi-Jiahe
Copy link

Dropped my_complex dependency in favor of more popular and updated complex package with null support and migrate to support null safety.

Update tuple to 2.0.0.

Removed benchmarking tests for my_complex adding multiplication, turning and invert.

@Yi-Jiahe
Copy link
Author

Incidentally, I modified the benchmarks to work with the complex package:

 test("complexpolar adding timed", () {
    Stopwatch s = new Stopwatch();
    var cp4 = Complex.polar(1, 1);
    var cp3 = Complex.polar(1, 0);
    num reps = math.pow(10, 6);
    s.start();
    for (int i = 0; i < reps; i++) {
      cp3 = cp3 + cp4;
    }
    s.stop();
    print("$reps repetitions: ${s.elapsedMilliseconds}ms");
  });

  test("complexpolar multiplication timed", () {
    Stopwatch s = new Stopwatch();
    var cp4 = Complex.polar(1, 1);
    var cp3 = Complex.polar(1, 0);
    num reps = math.pow(10, 6);
    s.start();
    for (int i = 0; i < reps; i++) {
      cp3 = cp3 * cp4;
    }
    s.stop();
    print("$reps repetitions: ${s.elapsedMilliseconds}ms");
  });

  test("complexpolar imaginary timed", () {
    Stopwatch s = new Stopwatch();
    var cp4 = Complex.polar(1, 1);
    double total = 0.0;
    num reps = math.pow(10, 6);
    s.start();
    for (int i = 0; i < reps; i++) {
      total += cp4.imaginary;
      cp4 = cp4 * Complex.polar(0.1);
    }
    s.stop();
    print("$reps repetitions: ${s.elapsedMilliseconds}ms");
  });

  test("complexpolar invert timed", () {
    Stopwatch s = new Stopwatch();
    var cp4 = new Complex.polar(1, 1);
    num reps = math.pow(10, 6);
    s.start();
    for (int i = 0; i < reps; i++) {
      cp4 = Complex(1) / cp4;
    }
    s.stop();
    print("$reps repetitions: ${s.elapsedMilliseconds}ms");
  });

And the results were
Original:

$ dart test
Building package executable...
Built test:test.
00:00 +3: test\fft_test.dart: complexpolar adding timed
1000000 repetitions: 29ms
00:00 +6: test\fft_test.dart: complexpolar multiplication timed
1000000 repetitions: 18ms
00:01 +7: test\fft_test.dart: complexpolar imaginary timed
1000000 repetitions: 24ms
00:01 +8: test\fft_test.dart: complexpolar invert timed
1000000 repetitions: 19ms
00:01 +17: All tests passed!

Updated:

$ dart test
00:00 +0: test\fft_test.dart: complexpolar adding timed
1000000 repetitions: 16ms
00:00 +4: test\fft_test.dart: complexpolar multiplication timed
1000000 repetitions: 13ms
00:00 +7: test\fft_test.dart: complexpolar imaginary timed
1000000 repetitions: 19ms
00:00 +8: test\fft_test.dart: complexpolar invert timed
1000000 repetitions: 19ms
00:01 +17: All tests passed!

@Yi-Jiahe Yi-Jiahe mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant