Skip to content

Commit

Permalink
Add benchmarks to test a pull request
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin D. Howard <gavin@gavinhoward.com>
  • Loading branch information
gavinhoward committed Dec 13, 2023
1 parent 5238763 commit fcbe9d6
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
10 changes: 10 additions & 0 deletions benchmarks/bc/newton_raphson_div_large.bc
@@ -0,0 +1,10 @@
#! /usr/bin/bc -lq

scale = 0
max = 10
mexp = 1000000

for (i = 0; i < max; ++i)
{
print irand(10), "^", irand(mexp), " / ", irand(10), "^", irand(mexp), "\n"
}
9 changes: 9 additions & 0 deletions benchmarks/bc/newton_raphson_div_small.bc
@@ -0,0 +1,9 @@
#! /usr/bin/bc -lq

scale = 0
max = 100000

for (i = 0; i < max; ++i)
{
print rand(), " / ", rand(), "\n"
}
10 changes: 10 additions & 0 deletions benchmarks/bc/newton_raphson_sqrt_large.bc
@@ -0,0 +1,10 @@
#! /usr/bin/bc -lq

scale = 0
max = 10
mexp = 1000000

for (i = 0; i < max; ++i)
{
print "sqrt(", irand(10), "^", irand(mexp), ")\n"
}
9 changes: 9 additions & 0 deletions benchmarks/bc/newton_raphson_sqrt_small.bc
@@ -0,0 +1,9 @@
#! /usr/bin/bc -lq

scale = 0
max = 100000

for (i = 0; i < max; ++i)
{
print "sqrt(", rand(), ")\n"
}
21 changes: 21 additions & 0 deletions manuals/development.md
Expand Up @@ -565,6 +565,26 @@ heavy functions in `lib.bc`.

The file to generate the benchmark to benchmark multiplication in `bc`.

##### `newton_raphson_div_large.bc`

The file to generate the benchmark to benchmark the Newton-Raphson division in
[GitHub PR #72][229] with large numbers.

##### `newton_raphson_div_small.bc`

The file to generate the benchmark to benchmark the Newton-Raphson division in
[GitHub PR #72][229] with small numbers.

##### `newton_raphson_sqrt_large.bc`

The file to generate the benchmark to benchmark the Newton-Raphson square root
in [GitHub PR #72][229] with large numbers.

##### `newton_raphson_sqrt_small.bc`

The file to generate the benchmark to benchmark the Newton-Raphson square root
in [GitHub PR #72][229] with small numbers.

##### `postfix_incdec.bc`

The file to generate the benchmark to benchmark `bc` using postfix increment and
Expand Down Expand Up @@ -5227,3 +5247,4 @@ However, where possible, errors are returned directly.
[226]: #errorssh
[227]: #errorsh
[228]: #vectorc
[229]: https://github.com/gavinhoward/bc/pull/72

0 comments on commit fcbe9d6

Please sign in to comment.