GithubHelp home page GithubHelp logo

klmitch / dbprim Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 1.82 MB

Database Primitives Library

License: Other

Makefile 1.24% C 89.39% Shell 0.02% M4 8.59% C++ 0.75%
c data-structures datastructures library

dbprim's People

Contributors

klmitch avatar spale75 avatar

Watchers

 avatar  avatar

dbprim's Issues

Add options

It would be good to have some sort of options that can be passed to dbprim functions. This would be an API change, as each function would now have an "opts" parameter that could be NULL. The only options for now would be alternate malloc/free, with support for arena-style functions, but I could see this being used in the future for threading (if I can ever figure out how to make that work!)

Add inhibit behavior for hash_resize_t callback

Right now, if the hash_resize_t callback returns non-zero, that value is returned from ht_resize(). The callback really should be able to inhibit a resize without causing ht_resize() to error out.

Split _ht_remove() from ht_remove()

The ht_flush() function called ht_remove(), but if AUTOSHRINK is on, ht_remove() could resize the table. This could potentially move some results to buckets that ht_flush() has already processed, leaving items in the hash table. The work-around is obviously to copy the bare minimum entry removal code into ht_flush(), but a better long-term solution could be to split ht_remove() to create an _ht_remove(), which would not contain the logic for resizing the table.

Optimize hash calculation

Every time the hash table routines call the hash computation function, the result is immediately passed through % table->ht_modulus and the result stored as the entry's hash. What we should do instead is separate the hash from the bucket index, thus avoiding the need to recompute the hash. This represents both an ABI change (additional he_index field in hash_entry_t) and an API change (previously, the hash algorithm could take the modulus into account, even though it's documented not to), so a version bump would be necessary.

Add heaps/priority queues

It would be nice to add a priority queue API to the library. This would likely not be intended to be long lived, but there's no reason to eliminate that possibility.

Add graphs

The proposal would be to drop sparse matrices and replace them with a more general graph data structure. This would have to include not just the basic storage, but also some graph algorithms and some support for implementing other algorithms. May have to account for both library-allocated edges (when the caller doesn't care) and caller-allocated edges (when the caller does care).

Keys should be a property of entries

The hash_entry_t and rb_node_t types contain a database key, but it gets set in routines like ht_add() or rb_add(). This database key really should be a property of the entry/node itself, and changing it should automatically move the entry within the container; so, for instance, ht_move() would become he_setkey().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.