From 9130e47b171c5182ffe6c14eb710fdcb73943de4 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sat, 13 Jul 2019 06:40:05 +0100 Subject: Adding initial support for HASH nodes This PR adds initial support for HASH data nodes in libbowl. This allows a performant key-value store lookup in a node tree. The hashing code implements the "murmur" hash, which has shown good performance over at [`libcuckoo`]. Currently there is no extended hashing strategy, which should definitely be changed. [`libcuckoo`]: https://github.com/qaul/libcuckoo (currently a collision will cause a recursive re-alloc) Some of the type-level hacks also begs the question if a PAIR data node might be warranted, even though it would break the simple design around bowl->data. --- examples/list.c | 8 ++++---- examples/tree.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/list.c b/examples/list.c index a09588b..84205e2 100644 --- a/examples/list.c +++ b/examples/list.c @@ -9,15 +9,15 @@ int main() struct bowl *a; data_malloc(&a, LITERAL, "Destroy capitalism"); - bowl_insert(root, a); + bowl_append(root, a); struct bowl *b; data_malloc(&b, INTEGER, 1312); - bowl_insert(root, b); + bowl_append(root, b); struct bowl *c; data_malloc(&c, LITERAL, "Alerta, Antifascista!"); - bowl_insert(root, c); + bowl_append(root, c); return bowl_free(root); -} \ No newline at end of file +} diff --git a/examples/tree.c b/examples/tree.c index e55acb9..eb1b33a 100644 --- a/examples/tree.c +++ b/examples/tree.c @@ -30,17 +30,17 @@ int main() if(e) return e; // Add the d node to c - e = bowl_insert(c, d); + e = bowl_append(c, d); if(e) e; // Add other nodes to root - e = bowl_insert(root, a); + e = bowl_append(root, a); if(e) return e; - e = bowl_insert(root, b); + e = bowl_append(root, b); if(e) return e; - e = bowl_insert(root, c); + e = bowl_append(root, c); if(e) return e; e = bowl_free(root); return e; -} \ No newline at end of file +} -- cgit v1.2.3