about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorGuillaume Pinot <texitoi@texitoi.eu>2015-01-10 20:14:21 +0100
committerGuillaume Pinot <texitoi@texitoi.eu>2015-01-10 20:19:54 +0100
commit629bcdd873dbe5d84977609a1114e0c3613b96c4 (patch)
tree08d983b3ad9986610093e61b622c4cd20df26c77 /src/libstd/sys/unix/stack_overflow.rs
parenta09b139f9c4c6f4a2c3fb78e906e3ae0abf7f901 (diff)
downloadrust-629bcdd873dbe5d84977609a1114e0c3613b96c4.tar.gz
rust-629bcdd873dbe5d84977609a1114e0c3613b96c4.zip
Improvement of shootout-binarytrees.rs
Part of #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
```
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions