> static inline void * > @@ -104,12 +101,11 @@ eina_array_foreach(Eina_Array *array, Eina_Each_Cb cb, > void *fdata) > Eina_Bool ret = EINA_TRUE; > > EINA_ARRAY_ITER_NEXT(array, i, data, iterator) > - if (cb(array, data, fdata) != EINA_TRUE) > - { > - ret = EINA_FALSE; > - break; > - } > - > + { > + if (cb(array, data, fdata) == EINA_TRUE) continue; > + ret = EINA_FALSE; > + break; > + } > return ret; > }
for these wouldn't EINA_LIKELY/UNLIKELY be more clear on what is the expected/preference to the user AND the compiler. What you did is likely to work for one compiler but not the other, if branch prediction preference is difference. Also, with clearlinux they use AutoFDO (https://gcc.gnu.org/wiki/AutoFDO), likely in future most distros should use that, thus this kind of micro-optimization is not that helpful. Given that we already run software we just compiled in the build tree we could even integrate autofdo to the build system (like compile - benchmark - compile)? > > diff --git a/src/lib/eina/eina_inline_hash.x b/src/lib/eina/eina_inline_hash.x > index ab87960..114b584 100644 > --- a/src/lib/eina/eina_inline_hash.x > +++ b/src/lib/eina/eina_inline_hash.x > @@ -33,11 +33,13 @@ eina_hash_djb2(const char *key, int len) > unsigned int hash_num = 5381 ^ eina_seed; > const unsigned char *ptr; > > - if (!key) return 0; > - for (ptr = (unsigned char *)key; len; ptr++, len--) > - hash_num = ((hash_num << 5) + hash_num) ^ *ptr; /* hash * 33 ^ c */ > - > - return (int)hash_num; > + if (key) > + { > + for (ptr = (unsigned char *)key; len; ptr++, len--) > + hash_num = ((hash_num << 5) + hash_num) ^ *ptr; /* hash * 33 ^ c */ > + return (int)hash_num; > + } > + return 0; > } for these, which are error handling, EINA_UNLIKELY() is much, much better to read and doesn't change the whole code because of 1 line. > static inline Eina_Bool > eina_lock_new(Eina_Lock *mutex) > { [...] > + return _eina_lock_new(mutex, EINA_FALSE); > } since you did not had a symbol before, why not just introduce one without the "_"? -- Gustavo Sverzut Barbieri -------------------------------------- Mobile: +55 (16) 99354-9890 ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel