Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvement of shootout-binarytrees.rs
Part of rust-lang#18085 Instead of using an Enum, we use a struct with Option<&Tree> as leaves. It allow to limit a lot of allocation. before: ``` texitoi@vaio:~/dev/benchmarksgame-rs$ time ./bin/binary-trees-orig 20 stretch tree of depth 21 check: -1 2097152 trees of depth 4 check: -2097152 524288 trees of depth 6 check: -524288 131072 trees of depth 8 check: -131072 32768 trees of depth 10 check: -32768 8192 trees of depth 12 check: -8192 2048 trees of depth 14 check: -2048 512 trees of depth 16 check: -512 128 trees of depth 18 check: -128 32 trees of depth 20 check: -32 long lived tree of depth 20 check: -1 real 0m3.860s user 0m11.032s sys 0m3.572s ``` after: ``` texitoi@vaio:~/dev/benchmarksgame-rs$ time ./bin/binary-trees 20 stretch tree of depth 21 check: -1 2097152 trees of depth 4 check: -2097152 524288 trees of depth 6 check: -524288 131072 trees of depth 8 check: -131072 32768 trees of depth 10 check: -32768 8192 trees of depth 12 check: -8192 2048 trees of depth 14 check: -2048 512 trees of depth 16 check: -512 128 trees of depth 18 check: -128 32 trees of depth 20 check: -32 long lived tree of depth 20 check: -1 real 0m2.824s user 0m9.224s sys 0m1.428s ```
- Loading branch information
629bcdd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+ rollup
Nice!