pragma unroll 4

This commit is contained in:
Richard Thier 2024-10-11 02:52:07 +02:00
parent 22ed78cd0e
commit 312c6f14ca
3 changed files with 2 additions and 5 deletions

View File

@ -115,7 +115,7 @@ int main() {
test_basics(mapmap, &mi);
/* Performance tests */
int i = 10000;
int i = 1000;
keystore(i, true);
datastore(i, true);

View File

@ -2,8 +2,6 @@ debug:
g++ main.cpp -g -Wall -o main
release:
g++ main.cpp -O2 -Wall -o main
release-native:
g++ main.cpp -fopt-info-vec-missed -march=native -O3 -Wall -o main
release-avx2:
g++ main.cpp -fopt-info-vec-missed -mavx2 -O3 -Wall -o main
release-avx2-asm:

View File

@ -95,6 +95,7 @@ typedef union simap_ptr64 simap_ptr64;
// TODO: We can possibly hand-optimise this with intrinsics maybe - but I hope autovectorization (does not seem to happen???)
static inline SM_ALWAYS_INLINE auint64 *make_tipp(auint64 *tip, auint64 prefix, auint64 *end) {
#pragma GCC unroll 4
while((tip < end) && (*tip != prefix)) ++tip;
return tip;
}
@ -111,8 +112,6 @@ static inline simap_ptr64 *simap_search_internal(simap_instance *map, const char
/* Construct keyremains - might point to the \0 terminator only if smallkey or 8 bytes exactly */
const char *keyremains = key + prefixlen;
/* TODO: Maybe this is buggy when we access behind our own data? */
/* TODO: Maybe I should create separate function for fast-lookup returning "next" pointer from a pointer to autovectorize? */
/* Lookup prefix (fast-key) - hopefully this gets vectorized (should be)!!! */
auint64 *base = map->base;
auint64 *end = (auint64 *)((uint8_t *)base + (map->usage_end));