Kent Overstreet
8e0baecf5c
Drop some dependencies on BigDigit's size
...
Before:
test divide_0 ... bench: 1,011 ns/iter (+/- 184)
test divide_1 ... bench: 18,535 ns/iter (+/- 770)
test divide_2 ... bench: 990,467 ns/iter (+/- 91,980)
test fac_to_string ... bench: 1,275 ns/iter (+/- 60)
test factorial_100 ... bench: 6,453 ns/iter (+/- 101)
test fib_100 ... bench: 1,142 ns/iter (+/- 99)
test fib_1000 ... bench: 18,713 ns/iter (+/- 2,172)
test fib_10000 ... bench: 1,197,965 ns/iter (+/- 21,178)
test fib_to_string ... bench: 225 ns/iter (+/- 13)
test from_str_radix_02 ... bench: 3,460 ns/iter (+/- 626)
test from_str_radix_08 ... bench: 1,324 ns/iter (+/- 24)
test from_str_radix_10 ... bench: 1,488 ns/iter (+/- 19)
test from_str_radix_16 ... bench: 969 ns/iter (+/- 22)
test from_str_radix_36 ... bench: 1,135 ns/iter (+/- 23)
test hash ... bench: 102,126 ns/iter (+/- 1,016)
test multiply_0 ... bench: 353 ns/iter (+/- 74)
test multiply_1 ... bench: 31,006 ns/iter (+/- 679)
test multiply_2 ... bench: 3,438,143 ns/iter (+/- 47,640)
test pow_bench ... bench: 7,457,045 ns/iter (+/- 96,175)
test shl ... bench: 5,627 ns/iter (+/- 121)
test shr ... bench: 5,054 ns/iter (+/- 112)
test to_str_radix_02 ... bench: 2,774 ns/iter (+/- 88)
test to_str_radix_08 ... bench: 980 ns/iter (+/- 425)
test to_str_radix_10 ... bench: 3,029 ns/iter (+/- 115)
test to_str_radix_16 ... bench: 788 ns/iter (+/- 14)
test to_str_radix_36 ... bench: 8,285 ns/iter (+/- 175)
After:
test divide_0 ... bench: 925 ns/iter (+/- 30)
test divide_1 ... bench: 17,660 ns/iter (+/- 379)
test divide_2 ... bench: 972,427 ns/iter (+/- 7,560)
test fac_to_string ... bench: 1,260 ns/iter (+/- 36)
test factorial_100 ... bench: 7,077 ns/iter (+/- 204)
test fib_100 ... bench: 1,124 ns/iter (+/- 32)
test fib_1000 ... bench: 18,475 ns/iter (+/- 166)
test fib_10000 ... bench: 1,192,748 ns/iter (+/- 27,128)
test fib_to_string ... bench: 228 ns/iter (+/- 10)
test from_str_radix_02 ... bench: 3,379 ns/iter (+/- 74)
test from_str_radix_08 ... bench: 1,355 ns/iter (+/- 24)
test from_str_radix_10 ... bench: 1,470 ns/iter (+/- 20)
test from_str_radix_16 ... bench: 958 ns/iter (+/- 239)
test from_str_radix_36 ... bench: 1,137 ns/iter (+/- 19)
test hash ... bench: 102,730 ns/iter (+/- 39,897)
test multiply_0 ... bench: 351 ns/iter (+/- 15)
test multiply_1 ... bench: 31,139 ns/iter (+/- 1,053)
test multiply_2 ... bench: 3,464,509 ns/iter (+/- 124,235)
test pow_bench ... bench: 7,448,428 ns/iter (+/- 326,903)
test shl ... bench: 5,784 ns/iter (+/- 190)
test shr ... bench: 4,820 ns/iter (+/- 63)
test to_str_radix_02 ... bench: 2,757 ns/iter (+/- 33)
test to_str_radix_08 ... bench: 989 ns/iter (+/- 67)
test to_str_radix_10 ... bench: 3,045 ns/iter (+/- 70)
test to_str_radix_16 ... bench: 787 ns/iter (+/- 24)
test to_str_radix_36 ... bench: 8,257 ns/iter (+/- 117)/
2016-07-14 21:56:16 -08:00
Josh Stone
388a3132b8
bigint: allow `Sub` to work in-place on the RHS
...
A new Fibonacci benchmark demonstrates the improvement by using both
addition and subtraction in each iteration of the loop, like #200 .
Before:
test fib2_100 ... bench: 4,558 ns/iter (+/- 3,357)
test fib2_1000 ... bench: 62,575 ns/iter (+/- 5,200)
test fib2_10000 ... bench: 2,898,425 ns/iter (+/- 207,973)
After:
test fib2_100 ... bench: 1,973 ns/iter (+/- 102)
test fib2_1000 ... bench: 41,203 ns/iter (+/- 947)
test fib2_10000 ... bench: 2,544,272 ns/iter (+/- 45,183)
2016-07-08 17:34:12 -07:00