Suboptimal codegen for integer slice matching without |
in inner elements #132254
Open
Description
opened on Oct 28, 2024
In maching without |
, this is not optimized as slice compare:
let s: &[u8];
match s {
&[b'a', b'b', ... , ..] => ...
_ => ...,
}
Slice compare:
let s: &[u8];
let target = b"...";
if s.len() >= target.len() && &s[..target.len()] == target {
...
} else {
...
}
Integer: https://godbolt.org/z/csxf5zeYs
&str
: https://godbolt.org/z/3Yr5nac3r
Not sure if this shoud be integer only.
Activity