restructured API for faster lookup without AVX and added a micro-optimization too
This commit is contained in:
parent
a26b411fd4
commit
418c8d289c
6
simap.h
6
simap.h
@ -109,7 +109,7 @@ static inline void* simap(void *amap_instance, AMAP_OP op, const char *key, void
|
||||
// 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;
|
||||
while((++tip < end) && (*tip != prefix));
|
||||
return tip;
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ static inline simap_ptr64 *simap_search_internal(simap_instance *map, const char
|
||||
if(!is_smallkey) {
|
||||
char *tippremains = (char *)((uint8_t *)tipp + sizeof(uint64_t));
|
||||
if(strcmp(keyremains, tippremains) != 0) {
|
||||
tipp = make_tipp(tipp + 1, prefix.u64, end);
|
||||
tipp = make_tipp(tipp, prefix.u64, end);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ static inline simap_ptr64 *simap_search_internal(simap_instance *map, const char
|
||||
+ sizeof(uint32_t));
|
||||
|
||||
if(retipp != tipp) {
|
||||
tipp = make_tipp(tipp + 1, prefix.u64, end);
|
||||
tipp = make_tipp(tipp, prefix.u64, end);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user