-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kill DoubleBigDigit; BigDigit := usize
Reimplement the low level arithmetic functions without DoubleBigDigit, and then change BigDigit to usize. This ends up being a pretty significant performance win, even with my relatively simple and dumb code - an assembly version could be much faster (x86 at least can implement all these operations with one or just a few instructions). Before: test divide_0 ... bench: 3,906 ns/iter (+/- 125) test divide_1 ... bench: 293,600 ns/iter (+/- 6,545) test divide_2 ... bench: 657,792,410 ns/iter (+/- 28,285,336) test factorial_100 ... bench: 6,538 ns/iter (+/- 971) test fib_100 ... bench: 1,431 ns/iter (+/- 39) test multiply_0 ... bench: 419 ns/iter (+/- 6) test multiply_1 ... bench: 34,637 ns/iter (+/- 550) test multiply_2 ... bench: 4,523,752 ns/iter (+/- 1,039,485) test shr ... bench: 535 ns/iter (+/- 13) test to_string ... bench: 621 ns/iter (+/- 58) After: test divide_0 ... bench: 3,138 ns/iter (+/- 136) test divide_1 ... bench: 123,971 ns/iter (+/- 2,817) test divide_2 ... bench: 158,154,850 ns/iter (+/- 3,874,826) test factorial_100 ... bench: 6,805 ns/iter (+/- 94) test fib_100 ... bench: 1,429 ns/iter (+/- 35) test multiply_0 ... bench: 108 ns/iter (+/- 15) test multiply_1 ... bench: 16,503 ns/iter (+/- 256) test multiply_2 ... bench: 1,851,549 ns/iter (+/- 39,648) test shr ... bench: 639 ns/iter (+/- 21) test to_string ... bench: 929 ns/iter (+/- 42)
- Loading branch information
1 parent
c9bee58
commit f2da663
Showing
1 changed file
with
110 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters