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

Make [u8]::reverse() 5x faster #41764

Merged
merged 3 commits into from May 10, 2017
Merged

Make [u8]::reverse() 5x faster #41764

merged 3 commits into from May 10, 2017

Commits on May 5, 2017

  1. Make [u8]::reverse() 5x faster

    Since LLVM doesn't vectorize the loop for us, do unaligned reads
    of a larger type and use LLVM's bswap intrinsic to do the
    reversing of the actual bytes.  cfg!-restricted to x86 and
    x86_64, as I assume it wouldn't help on things like ARMv5.
    
    Also makes [u16]::reverse() a more modest 1.5x faster by
    loading/storing u32 and swapping the u16s with ROT16.
    
    Thank you ptr::*_unaligned for making this easy :)
    scottmcm committed May 5, 2017
    Copy the full SHA
    e8fad32 View commit details
    Browse the repository at this point in the history

Commits on May 6, 2017

  1. Copy the full SHA
    1f891d1 View commit details
    Browse the repository at this point in the history
  2. Add reverse benchmarks for u128, [u8;3], and Simd<[f64;4]>

    None of these are affected by e8fad32.
    scottmcm committed May 6, 2017
    Copy the full SHA
    da91361 View commit details
    Browse the repository at this point in the history