After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770616 - GHashTable: Robin Hood hashing
GHashTable: Robin Hood hashing
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: ghashtable
2.49.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-08-30 22:42 UTC by Hans Petter Jansson
Modified: 2018-05-24 19:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-GHashTable-Change-from-quadratic-probing-to-Robin-Ho.patch (18.82 KB, patch)
2016-08-30 22:42 UTC, Hans Petter Jansson
none Details | Review

Description Hans Petter Jansson 2016-08-30 22:42:34 UTC
Created attachment 334488 [details] [review]
0001-GHashTable-Change-from-quadratic-probing-to-Robin-Ho.patch

Alex' prodding in bug 526456 motivated me to patch GHashTable to use Robin Hood hashing. The patch passes the tests and works when linked with Evolution, but I'm still skeptical of its performance benefits.

One nice thing about it is that I was able to eliminate the use of tombstones entirely.

It still needs proper benchmarking of insertions, removals and lookups in an appropriate mix alongside the current implementation.

There may also be some microoptimization/cleanup left to do.
Comment 1 Hans Petter Jansson 2016-11-24 14:27:39 UTC
Just leaving this here so I don't forget; Python hash tables save memory by adding one level of indirection:

https://mail.python.org/pipermail/python-dev/2012-December/123028.html

That's another optimization we could try.
Comment 2 Emmanuele Bassi (:ebassi) 2016-11-24 14:40:12 UTC
Good article on the potential accidental quadratic behaviour of Robin Hood hashing as discovered by the Rust community:

http://accidentallyquadratic.tumblr.com/post/153545455987/rust-hash-iteration-reinsertion
Comment 3 Alexander Larsson 2017-02-27 11:45:07 UTC
Here are some additional tricks you can do for robin hood hashes:
https://probablydance.com/2017/02/26/i-wrote-the-fastest-hashtable/
Comment 4 GNOME Infrastructure Team 2018-05-24 19:04:29 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/1198.