Commit Graph

22 Commits

Author SHA1 Message Date
Nicolas Kirchner 10127907f5 Add a bench for bigint multiply
This bench allows to see the increase of time
if we double the size of one of the operands.
2017-08-03 18:30:09 +02: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
Josh Stone 609629d34d bigint: simplify the add2/sub2 loops
This splits the main arithmetic loops from the final carry/borrow
propagation, and also normalizes the slice lengths before iteration.
This lets the optimizer generate better code for these functions.
2016-06-29 18:19:47 -07:00
Josh Stone 1ebcc77513 Expand bigint shl/shr benchmarking 2016-01-27 22:53:10 -08:00
Josh Stone e8d948a3d2 Reduce the size of the BigUint pow benchmark
If a benchmark takes very long to run, it's harder to iterate on changes
to see their effect.  Even reduced to 100, this pow_bench takes around 8
seconds on my machine, and still shows meaningful optimization effects.
2016-01-06 18:32:01 -08:00
David Hewson 71b2e0627c Benchmark pow on BigUint (from #152) 2016-01-06 18:32:01 -08:00
Josh Stone b84142fc28 bigint: add a Hash test 2015-12-16 22:32:00 -08:00
Josh Stone 84542e6e03 Add benchmarks for bigint to/from_str_radix 2015-12-15 21:31:05 -08:00
Kent Overstreet a1e57a48b2 Add multiplication/division benchmarks
Add benchmarks that test multiplies/divides of different sizes
2015-12-10 12:22:54 -09:00
Kent Overstreet dbd22cfdd8 fix some annoying build warnings 2015-12-10 12:22:54 -09:00
Alex Crichton 82645a31df Don't print to stdout on `cargo bench` 2015-05-26 07:21:12 -07:00
Alex Crichton a6a399d52e Enable testing on stable Rust 2015-05-19 09:22:06 -07:00
kennytm 24d2f15ccf Avoid and remove some unstable features.
The only #[feature] left for now is the bencher.
2015-04-05 03:09:29 +08:00
Darin Morrison 2ef6c1057c Fix warnings in pidigits benchmark 2015-03-17 22:22:06 -06:00
Alex Crichton bde434903d Merge pull request #47 from jbcrail/fix-deprecated-range
Remove range function.
2015-01-12 11:02:46 -06:00
Joseph Crail d196c2b818 Remove range function.
For the pi benchmark, I replaced the range function with the new range
syntax.
2015-01-11 23:54:25 -05:00
Joseph Crail c42680d21e Replace deprecated int references with i32/isize.
I replaced most int refs with i32, and I used isize to hold the number
of default digits.
2015-01-11 23:51:02 -05:00
Sven Nilsen ae3bb3619c Upgrade to latest Rust
A `_0` test fails, but don’t know why
2015-01-03 19:30:05 +01:00
gifnksm a325a566c6 update to latest rustc
Now, arithmetic binary operator traits take operands by value,
but non-copyable types such as `BigUint` should not always moved out when
applying operators.

This commit implements these operators not only for bare structs also
these references.
By-value implementations are forwarded to by-reference implementations
for now. In the future, by-value implementations may be replaced with
more efficient implementations (for example, the implementation that
reuses moved buffers.)
2014-12-16 23:44:16 +09:00
gifnksm 29011d14d9 std::from_str::FromStr -> std::str::FromStr 2014-11-17 22:38:12 +09:00
gifnksm 2155e7d2ee Add numeric functions and `traits` module that provide numeric traits for generic
mathematcs.

Import numeric traits and functions that were removed from the standard library.
This also implements `AdditiveIterator` and `MultiplicativeIterator` for
`BigUint` and `BigInt`.

closes #28
2014-11-16 19:37:49 +09:00
Aaron Turon 4fa331aa41 Added shootout benchmark 2014-09-16 11:41:09 -07:00