benchmarks: add Ramanujan's formula for calculating pi#483
Conversation
6c6335e to
a468409
Compare
chfast
left a comment
There was a problem hiding this comment.
Looks ok. How long does it run?
|
|
||
| 31415926535897932 | ||
|
|
||
| pi_30_runs |
There was a problem hiding this comment.
I don't think adding more than one execution benchmark adds any additional information. It rather just make running benchmarks take longer.
62f20d0 to
9f97cd7
Compare
Codecov Report
@@ Coverage Diff @@
## master #483 +/- ##
=======================================
Coverage 99.67% 99.67%
=======================================
Files 54 54
Lines 17180 17180
=======================================
Hits 17125 17125
Misses 55 55 |
|
The wat can be found here: https://gist.github.com/axic/1b330d744148e2aa46085f0f69521b40 |
| { | ||
| // This dumb implementation of Ramanujan series calculates 1/pi | ||
| double ret = 0.0; | ||
| for (unsigned k = 0; k < n; k++) { |
There was a problem hiding this comment.
For "more floating point" and fun, you can make it double k.
|
|
||
| #define WASM_EXPORT __attribute__((visibility("default"))) | ||
|
|
||
| static unsigned factorial(unsigned n) |
There was a problem hiding this comment.
Can be also implemented with double n.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
So what's the point of this benchmark if only 10-20% of instructions is floating-point?
There was a problem hiding this comment.
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).
See