p-ranav / oystr Goto Github PK
View Code? Open in Web Editor NEWoystr recursively searches directories for a substring.
License: MIT License
oystr recursively searches directories for a substring.
License: MIT License
bob@LAPTOP-JDRTARVO:~/dev/search$ time grep -irn 'qmi' ../quectel-CM/NOTICE
3:The APIs of QMI WWAMN interfaces are defined by Qualcomm. And this program complies with Qualcomm QMI WWAN interfaces specification.
real 0m0.002s
user 0m0.002s
sys 0m0.000s
bob@LAPTOP-JDRTARVO:~/dev/search$ time ./build/search -irn 'qmi' ../quectel-CM/NOTICE
real 0m0.002s
user 0m0.002s
sys 0m0.001s
#include <immintrin.h>
const char* find_avx2_more(const char* b, const char* e, char c)
{
const char* i = b;
__m256i q = _mm256_set1_epi8(c);
for (; i + 32 < e; i += 32) {
__m256i x = _mm256_lddqu_si256(reinterpret_cast<const __m256i*>(i));
__m256i r = _mm256_cmpeq_epi8(x, q);
int z = _mm256_movemask_epi8(r);
if (z)
return i + __builtin_ffs(z) - 1;
}
if (i < e) {
if (e - b < 32) {
for (; i < e; ++i)
if (*i == c)
return i;
} else {
i = e - 32;
__m256i x = _mm256_lddqu_si256(reinterpret_cast<const __m256i*>(i));
__m256i r = _mm256_cmpeq_epi8(x, q);
int z = _mm256_movemask_epi8(r);
if (z)
return i + __builtin_ffs(z) - 1;
}
}
return e;
}
auto needle_search_avx2(std::string_view needle,
std::string_view::const_iterator haystack_begin,
std::string_view::const_iterator haystack_end,
bool ignore_case)
{
if (needle.empty()) {
return haystack_end;
}
const char c = needle[0];
// quickly find c in haystack
auto it = haystack_begin;
while (it != haystack_end) {
const char* ptr = find_avx2_more(it, haystack_end, c);
bool result = true;
const char* i = ptr;
for (auto& n : needle) {
if (n != *i) {
result = false;
break;
}
i++;
}
if (result) {
return ptr;
} else {
it = i;
}
}
return haystack_end;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.