Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialize equality for [T] and comparison for [u8] to use memcmp when possible #32699

Merged
merged 3 commits into from
Apr 7, 2016

Commits on Apr 5, 2016

  1. Specialize equality for [T] and comparison for [u8]

    Where T is a type that can be compared for equality bytewise, we can use
    memcmp. We can also use memcmp for PartialOrd, Ord for [u8] and by
    extension &str.
    
    This is an improvement for example for the comparison [u8] == [u8] that
    used to emit a loop that compared the slices byte by byte.
    
    One worry here could be that this introduces function calls to memcmp
    in contexts where it should really inline the comparison or even
    optimize it out, but llvm takes care of recognizing memcmp specifically.
    bluss committed Apr 5, 2016
    Configuration menu
    Copy the full SHA
    5d56e1d View commit details
    Browse the repository at this point in the history
  2. Add test for [u8]'s Ord (and fix the old test for ord)

    The old test for Ord used no asserts, and appeared to have a wrong test. (!).
    bluss committed Apr 5, 2016
    Configuration menu
    Copy the full SHA
    28c4d12 View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2016

  1. slice: Use doc(hidden) on private traits

    This should avoid the trait impls showing up in rustdoc.
    bluss committed Apr 6, 2016
    Configuration menu
    Copy the full SHA
    a6c27be View commit details
    Browse the repository at this point in the history