Commit Graph

23 Commits

Author SHA1 Message Date
subhransu mohanty da39f53b95 eina/hash: optimize eina_hash_find() when hash is empty.
Summary:
Check if hash is empty before computing the hash key and look inside the
hash to find data.

Note: could have called the eina_hash_population() api but didn't
      because of extra function call.

Reviewers: Hermet

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9531
2019-08-09 14:00:03 +09:00
Mike Blumenkrantz 662572ecfe eina/hash: add direct variants of list append/prepend functions
Summary:
this simplifies the process of manipulating lists inside hashes with a
non-copied key

@feature

Depends on D9205

Reviewers: cedric

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9206
2019-07-10 14:40:42 -04:00
Vincent Torri 4ae6eeb2cf efl: remove _MSC_VER (Visual Studio macro) usage in source code 2018-01-04 12:59:47 -08:00
Cedric BAIL b410417d68 eina: silence warning. 2017-10-19 16:34:25 -07:00
Cedric Bail e0807ce797 eina: fix eina_hash_stringshared_new to actually compute the hash on the pointer.
Before this patch, the key would always be zero and the hash would solely
rely on the rbtree to be efficient. This improve the situation by using the pointer
as the key during hash computation.
2017-10-17 16:15:18 -07:00
Cedric Bail 29c6c3b95b eina: refactor eina hash computation of key length and hash value. 2017-10-17 16:15:18 -07:00
Carsten Haitzler 41842ca9f9 efl - fix many bounds over/underflow where we use int for ptr cmp
this addresses more things brought up in comments in

fixes T3638 commentd

@fix
2016-05-26 12:17:07 +09:00
Carsten Haitzler 636c8b48c7 eina hash - fix stringshare key comparison function
this fixes T3638

@fix

a note... thanks so much to aerodynamik for spotting this. i'm rather
surprised coverity didn't spot this... unless someone said to "shut up
coverity you're wrong" and they should not have.

i also might have expected compilers to spot this too... and add a
warning.

anyway ... this was a seriously subtle bug that could have caused all
kinds of havoc in efl.  keys that are different may be compared to be
the same. it could get ordering wrong and sorting thus maybe insert
keys that cannot be found anymore and oh so much more besides.
2016-05-26 09:28:23 +09:00
Cedric BAIL 5aa6a73b34 eina: return NULL iterator in all case, not only when safety check is turned on. 2016-01-04 15:13:06 -08:00
Mike Blumenkrantz b550d5becb eina_hash now has helper functions for managing lists inside hashes
@feature
2014-04-25 10:52:15 -04:00
Cedric Bail 2e9f96cc24 eina: this is actually a better way of improving Eina_Hash performance.
This reduce the size of the rbtree part dedicated to the hash key match,
but reuse only bit that weren't matched by the bucket.
2013-12-05 16:32:02 +09:00
Cedric Bail ff845b0a7c eina: improve cmp function of eina_hash string related hash.
For strings, we already know the length, so let's just not call the
heavy strcmp if the length is not already the same. Get some easy
speedup here.
2013-12-04 19:05:03 +09:00
Cedric Bail df909605c5 eina: increase hash matching inside of Eina_Hash.
This is the correct implementation of the idea developped in Lucas De Marchi's blog :
http://www.politreco.com/2013/09/optimizing-hash-table-with-kmod-as-testbed/

This give an interesting +15% for all Eina_Hash user whatever hash function they use. The inlined
djb2 is still the fastest one and all other give very close result. It does increase memory foot
print, but as much as the previous way of doing it.
2013-12-04 18:33:05 +09:00
Cedric Bail 3c7185e880 Revert "eina: check if the complete hash match before checking if the key match during children walk."
This reverts commit 295babadb1.

The implementation of that said optimization is actually wrong.
2013-12-04 18:33:04 +09:00
Cedric Bail 926f4c5e84 efl: detect 64 bits correctly. 2013-11-09 19:48:31 +09:00
Carsten Haitzler 69e27abdc3 eina - and e3fl in general - stop using eina_error_get/set - useless really 2013-10-11 16:50:40 +09:00
Cedric Bail 295babadb1 eina: check if the complete hash match before checking if the key match during children walk.
This give an interesting +15% for all Eina_Hash user whatever hash function they use. The inlined
djb2 is still the fastest one and all other give very close result.

This idea was given by Lucas De Marchi's blog :
http://www.politreco.com/2013/09/optimizing-hash-table-with-kmod-as-testbed/

I do believe that rolling a crc32 implementation as a hash function should give interesting result
in our test.
2013-09-26 15:51:25 +09:00
Cedric BAIL a11fe38afc eina: remove the most costly boolean ever.
We did use this 'begin' boolean to make eina_hash always allocate only
once per item it push in the hash. This boolean was alone at the end of
a structure. It would have costed us 4bytes on 32bits system and 8bytes
on 64bits. Removing it make elemines consume 100KB less on 32bits system.

We may have a speed impact on hash insertion here, but I don't think we
do use eina_hash_add and friends in any hot path, at the moment. If that
was the case there would be some way to mitigate this, just not worth it
at the moment.
2013-04-04 11:22:43 +09:00
Cedric BAIL d9cafa2052 eina: disable randomisation for Eina_Hash superfast.
SVN revision: 83698
2013-02-07 03:07:32 +00:00
Cedric BAIL 01dba3fbc0 efl/eina: prevent denial of service on eina_hash.
Thanks goes to Thiago Macieira for sharing the issue. This
is the result of the cross-desktop talk at fosdem. A lot more
comming in the futur !


SVN revision: 83578
2013-02-04 07:52:56 +00:00
Lucas De Marchi 23b741699f efl: remove check for inttypes.h and stdint.h
SVN revision: 82580
2013-01-10 20:25:39 +00:00
Vincent Torri 7fe3d35994 merge: __UNUSED__ --> EINA_UNUSED and some fixes in eo.
SVN revision: 77542
2012-10-05 20:09:47 +00:00
Vincent Torri 785f2a6b3a merge : add eina
currently, examples, tests and benchmark are not set. That's the next things i'll do


SVN revision: 76710
2012-09-16 10:57:48 +00:00