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

benchmarks: add Ramanujan's formula for calculating pi #483

Merged
merged 1 commit into from
Aug 23, 2020
Merged

Conversation

@axic axic force-pushed the bench-ramunajan branch from aae84bc to a34401d Compare August 13, 2020 15:10
@axic axic changed the title benchmarks: add Ramunajan's formula for calculating pi benchmarks: add Ramanujan's formula for calculating pi Aug 13, 2020
Copy link
Collaborator

@chfast chfast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok. How long does it run?


31415926535897932

pi_30_runs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think adding more than one execution benchmark adds any additional information. It rather just make running benchmarks take longer.

@axic axic force-pushed the bench-ramunajan branch 2 times, most recently from 62f20d0 to 9f97cd7 Compare August 14, 2020 18:57
@codecov
Copy link

codecov bot commented Aug 14, 2020

Codecov Report

Merging #483 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #483   +/-   ##
=======================================
  Coverage   99.67%   99.67%           
=======================================
  Files          54       54           
  Lines       17180    17180           
=======================================
  Hits        17125    17125           
  Misses         55       55           

@axic axic changed the base branch from bench-taylor to master August 14, 2020 19:04
@axic axic force-pushed the bench-ramunajan branch from 9f97cd7 to 244ef11 Compare August 14, 2020 19:33
@axic
Copy link
Member Author

axic commented Aug 14, 2020

@axic axic requested a review from chfast August 14, 2020 19:37
{
// This dumb implementation of Ramanujan series calculates 1/pi
double ret = 0.0;
for (unsigned k = 0; k < n; k++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For "more floating point" and fun, you can make it double k.


#define WASM_EXPORT __attribute__((visibility("default")))

static unsigned factorial(unsigned n)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be also implemented with double n.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah thought about those, but kind of resorted that perhaps for forcefully having "more floating point" perhaps a hand crafted synthetic benchmark using all ops is better?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's the point of this benchmark if only 10-20% of instructions is floating-point?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolute number of instructions or instructions weighted by the number of times they are executed?

If you profile it it should be clear the heavy part is the floating point calculation (pow, etc.). The factorial part only works with small number (<30).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then.

@axic axic force-pushed the bench-ramunajan branch from 244ef11 to 364ef02 Compare August 21, 2020 23:26
@axic axic force-pushed the bench-ramunajan branch from 364ef02 to cd55199 Compare August 23, 2020 10:28
@axic axic merged commit 10e1d14 into master Aug 23, 2020
@axic axic deleted the bench-ramunajan branch August 23, 2020 10:46
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.

2 participants