rust/src/libsyntax
Markus 7721d46bd7 Utilize discriminant_value for more efficient deriving
The new code generated for deriving on enums looks something like this:

```rust
let __self0_vi = unsafe {
    std::intrinsics::discriminant_value(&self) } as i32;
let __self1_vi = unsafe {
    std::intrinsics::discriminant_value(&__arg1) } as i32;
let __self2_vi = unsafe {
    std::intrinsics::discriminant_value(&__arg2) } as i32;
///
if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... {
    match (...) {
        (Variant1, Variant1, ...) => Body1
        (Variant2, Variant2, ...) => Body2,
        ...
        _ => ::core::intrinsics::unreachable()
    }
}
else {
    ... // catch-all remainder can inspect above variant index values.
}
```
This helps massively for C-like enums since they will be compiled as a
single comparison giving observed speedups of up to 8x. For more complex
enums the speedup is more difficult to measure but it should not be
slower to generate code this way regardless.
2015-06-13 20:40:59 +02:00
..
diagnostics change some statics to constants 2015-06-07 19:50:13 +02:00
ext Utilize discriminant_value for more efficient deriving 2015-06-13 20:40:59 +02:00
parse Auto merge of #26190 - Veedrac:no-iter, r=alexcrichton 2015-06-11 18:10:08 +00:00
print Conver reborrows to .iter() calls where appropriate 2015-06-11 13:56:07 +01:00
util syntax: replace sess.span_diagnostic.cm with sess.codemap(). 2015-05-14 01:47:56 +03:00
abi.rs Fallout in libsyntax 2015-04-01 11:22:39 -04:00
ast.rs Make various fixes: 2015-05-21 11:47:30 -04:00
ast_util.rs Conver reborrows to .iter() calls where appropriate 2015-06-11 13:56:07 +01:00
attr.rs Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
codemap.rs Conver reborrows to .iter() calls where appropriate 2015-06-11 13:56:07 +01:00
config.rs syntax: Remove uses of #[feature(slice_patterns)] 2015-04-21 10:08:26 -07:00
diagnostic.rs Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
feature_gate.rs Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
fold.rs Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
lib.rs syntax: move ast_map to librustc. 2015-06-10 02:40:45 +03:00
owned_slice.rs Switched to Box::new in many places. 2015-03-03 21:05:55 +01:00
ptr.rs syntax: remove #![feature(box_syntax, box_patterns)] 2015-04-21 10:07:48 -07:00
show_span.rs std: Stabilize FromStr and parse 2015-01-30 08:52:44 -08:00
std_inject.rs Unquote all crate names without underscores 2015-03-27 10:58:12 -07:00
str.rs syntax: Copy unstable str::char_at into libsyntax 2015-04-21 10:23:53 -07:00
test.rs Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
visit.rs Conver reborrows to .iter() calls where appropriate 2015-06-11 13:56:07 +01:00