Commit Graph

15 Commits

Author SHA1 Message Date
Josh Stone 8f5a27284c Remove an unused ToBigUint import 2016-07-12 00:40:10 -07: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
Kent Overstreet 1e65e9dc51 bigint: Fix calculation of size for multiply temporaries
When x.len() and y.len() are both equal and odd, we have x1.len() + y1.len() + 1
(the required size to multiply x1 and y1) > y.len() + 1

This fixes #187
2016-04-20 15:48:02 -08:00
Josh Stone 0b79edc108 bigint: add path-dependency versions 2016-04-14 00:26:54 -07:00
Josh Stone 2e8ce33d84 Bump all num crates to 0.1.32 2016-04-14 00:17:42 -07:00
Łukasz Jan Niemier 58b5fe5883 Serializers dependencies 2016-04-11 20:43:07 +02:00
Łukasz Jan Niemier e59ead7b3a Add Serde crate to `num_bigint` 2016-04-11 12:32:10 +02:00
Łukasz Jan Niemier 3d11940538 Better descriptions for subcrates 2016-04-10 10:31:22 +02:00
Josh Stone 03884fdbcc bigint: reapply #176 2016-03-25 17:50:51 -07:00
Josh Stone aebbc4fd37 bigint: fix and un-ignore the first doctest 2016-03-25 17:50:51 -07:00
Josh Stone 21a328ad6d bigint, rational: use std::hash only for testing 2016-03-25 17:50:51 -07:00
Łukasz Jan Niemier 7c0ab30bdc Fix subpackages metadata 2016-03-11 10:22:26 +01:00
Łukasz Jan Niemier 54685c46a1 Extract rational 2016-03-11 01:06:37 +01:00
Łukasz Jan Niemier 2176b7048c Extract bigint 2016-03-11 01:06:05 +01:00