hamt

Languages and libraries

data structure library

SHOW HN2023

171points
56comments
#353of 3,109 in 2023
Top 12%of 2023 by points

How HN took it

CuriousMostly questions and neutral comments

8 positive, 26 neutral or asking, 0 mixed, 7 critical, out of 41 comments about the project. Thread score +0.13.

Idea: 4 for, 1 againstDocs: 3 for, 1 againstDesign: 0 for, 3 againstExecution: 1 for, 1 againstPerformance: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Clean, readable code and documentation

    From 3 comments
    • I like how readable the code and docs are. Thanks for sharing.
      pkkm on HN
    • Not much to add other than this is cool and the README was very informative. Nice work!
      ghotli on HN
    • Doc fix: Iterators section repeats a code block with these declaration from the previous section: ``` size_t hamt_size(const struct hamt *trie); const void *hamt_get(const struct…
      kazinator on HN
  • Good data structure for C; a standard HAMT in C could set a precedent

    From 2 comments
    • I discovered HAMTs first when Erlang added support for first-class maps, and it was sort of a "holy shit!" moment for me. They felt like the "holy grail" of data structures for…
      tombert on HN
    • Good datastructure, code looks quite clean for C. Your API is missing some of the advantages relative to hash tables though. Because it's a tree, operations like union and…
      JonChesterfield on HN

Objections

  • Allocator API design is debated; commenters prefer a context-carrying or malloc-compatible interface

    From 3 comments
    • Just a note about your 'exported memory allocation' API: ``` struct hamt_allocator { void *(*malloc)(const size_t size); void *(*realloc)(void *chunk, const size_t size); void…
      thechao on HN
    • > But I know a lot of people get confused and/or don't like having to pass (& thus keep) so much information to the allocator. That's not why I think it' a bad idea. I prefer the…
      lelanthran on HN
    • I would drop the API directly and concentrate on the algorithm. If users integrating HAMT need a different allocator situation, they can solve that problem by themselves, without…
      kazinator on HN
  • Performance could improve with a 64-bit bitmap and iterative lookup

    From 1 comment
    • I have spotted a couple of ways to improve performance: Increase the size of the bitmap in each node from 32 bits to 64 bits. You are wasting 4 bytes per node, and wider nodes…
      fanf2 on HN

Requests

  • Add batch construction from N key/value pairs

    From 1 comment
    • Good datastructure, code looks quite clean for C. Your API is missing some of the advantages relative to hash tables though. Because it's a tree, operations like union and…
      JonChesterfield on HN
  • Add userdata member to the allocator struct

    From 1 comment
    • Nice! I think you should really add a userdata member to hamt_allocator. Not every memory allocator is global!
      spacechild1 on HN

Questions

  • How does it handle memory deallocation without a garbage collector

    From 1 comment
    • How does this compare to https://github.com/arximboldi/immer (other than the C/C++ difference)? Also, it's my understanding that, in practice, persistent data structures require…
      erichocean on HN
  • How does it compare to immer

    From 1 comment
    • How does this compare to https://github.com/arximboldi/immer (other than the C/C++ difference)? Also, it's my understanding that, in practice, persistent data structures require…
      erichocean on HN

Alternatives named

  • immer (C++ persistent data structures)

    From 2 comments
    • How does this compare to https://github.com/arximboldi/immer (other than the C/C++ difference)? Also, it's my understanding that, in practice, persistent data structures require…
      erichocean on HN
    • If you're interested in persistent data structures for C++, then I highly recommend Immer. High quality and easy to work with. https://github.com/arximboldi/immer
      vinkelhake on HN
  • Crit-bit trees

    From 1 comment
    • Are these the same as Crit-bit trees [0]? [0]: https://cr.yp.to/critbit.html Edit: I think I understand now from the design section on your page, they are both tries, but the…
      commandersaki on HN
  • Swiss Tables

    From 1 comment
    • how does HAMTs compare with more recent designs like Swiss Tables? [1] [1] https://abseil.io/about/design/swisstables
      nnx on HN
  • Boehm GC for memory management

    From 1 comment
    • > How does your implementation handle that? This is explained in the readme[1]. You can pass custom allocation functions (mallic, realloc, free), so you can plug in Boehm fex.…
      magicalhippo on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/36672957)