about summary refs log tree commit diff
path: root/src/libstd/panic.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-05-14 22:04:58 -0700
committerbors <bors@rust-lang.org>2016-05-14 22:04:58 -0700
commit088d4178522d4e9464c6beac70b14724670ee735 (patch)
tree9dd809af620bc5e5615e7f5d183d0929723c67c1 /src/libstd/panic.rs
parentdd0ef17a2dee42680bcec6ffd4ee2290f94d8d98 (diff)
parent0eeb14eaba04025aa8a4612e1935f04f2ca3fb6b (diff)
downloadrust-088d4178522d4e9464c6beac70b14724670ee735.tar.gz
rust-088d4178522d4e9464c6beac70b14724670ee735.zip
Auto merge of #33593 - dotdash:smart_derive, r=brson
Improve derived implementations for enums with lots of fieldless variants

A number of trait methods like PartialEq::eq or Hash::hash don't
actually need a distinct arm for each variant, because the code within
the arm only depends on the number and types of the fields in the
variants. We can easily exploit this fact to create less and better
code for enums with multiple variants that have no fields at all, the
extreme case being C-like enums.

For nickel.rs and its by now infamous 800 variant enum, this reduces
optimized compile times by 25% and non-optimized compile times by 40%.
Also peak memory usage is down by almost 40% (310MB down to 190MB).

To be fair, most other crates don't benefit nearly as much, because
they don't have as huge enums. The crates in the Rust distribution that
I measured saw basically no change in compile times (I only tried
optimized builds) and only 1-2% reduction in peak memory usage.
Diffstat (limited to 'src/libstd/panic.rs')
0 files changed, 0 insertions, 0 deletions