Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.5 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.5 KB

std::find simd version

std::find doesn't use simd intrinsics. ( check https://gms.tf/stdfind-and-memchr-optimizations.html )

So i thought simd can make std::find faster for some types.

Feature

  • avx2 intrinsic is used
  • You don't need worry about alignment problem. ( this library handle it )

Requirement

  • iterator's value type should be scalar type and type size of it should be 1 or 2 or 4 or 8
  • iterator should be random access iterator
  • require avx2 option
  • require c++ 11

Usage

std::vector<short> a;
a.reserve(1001);
for (unsigned short i = 0; i <= 1000; i++)
{
  a.push_back(i);
}

for (short i = 0; i < 1000; i++)
{
  fast_find_simd::find_simd(a.begin(), a.end(), (short)i);
}

Performance Comparison

tested on release mode, msvc, x64, windows
20211128031529

To develop