You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
improve codegen of fmt_num to delete unreachable panic
it seems LLVM doesn't realize that `curr` is always decremented at least
once in either loop formatting characters of the input string by their
appropriate radix, and so the later `&buf[curr..]` generates a check for
out-of-bounds access and panic. this is unreachable in reality as even
for `x == T::zero()` we'll produce at least the character
`Self::digit(T::zero())` for at least one character output, and `curr`
will always be at least one below `buf.len()`.
adjust `fmt_int` to make this fact more obvious to the compiler, which
fortunately (or unfortunately) results in a measurable performance
improvement for workloads heavy on formatting integers.
0 commit comments