diff --git a/Data-structure-survey.md b/Data-structure-survey.md index feaf35e..5a125df 100644 --- a/Data-structure-survey.md +++ b/Data-structure-survey.md @@ -47,13 +47,13 @@ fair chance this will become a historical document rather than being maintained as a current one. -# `isc/astack` +# `isc_astack` Fixed-size array stack ## used by - * `isc/netmgr/netmgr` for object caches + * `netmgr` for object caches ## notes @@ -65,25 +65,25 @@ Will be gone after the netmgr refactoring and replaced with per-thread object pools/lists -# `isc/heap` +# `isc_heap` Priority queue ## used by - * `dns/rbtdb` to find nodes by TTL; there are multiple heaps split + * `dns_rbtdb` to find nodes by TTL; there are multiple heaps split based on node->locknum like a few other parts of rbtdb. - * `dns/zoneverify` for checking consistency of NSEC3 chains. + * `dns_zoneverify` for checking consistency of NSEC3 chains. - * `isc/timer`, the canonical use for a heap. + * `isc_timer`, the canonical use for a heap. ## notes Single-threaded. There's a min-heap in libuv, implemented as a binary tree. The -standard algorithms (as in `isc/heap`) use an array which should have +standard algorithms (as in `isc_heap`) use an array which should have better performance. ## Ondřej's notes @@ -91,7 +91,7 @@ better performance. The usage in isc_timer has been removed in the loopmgr branch -# `isc/ht` +# `isc_ht` Hash table @@ -100,10 +100,10 @@ Hash table * `bin/plugins/filter-a` and `bin/plugins/filter-aaaa` for finding the filter state given a `query_ctx_t` pointer. (case-sensitive) - * `dns/adb` for looking up nameservers by name (case-insensitive) or + * `dns_adb` for looking up nameservers by name (case-insensitive) or by address (case-insensitive???). - * `dns/catz` (which leaks into `bin/named/server`) for the list of + * `dns_catz` (which leaks into `bin/named/server`) for the list of catalog zones in a view, and the entries in a catalog zone. These hash tables are unexpectedly case-sensitive. @@ -117,23 +117,27 @@ Hash table `catalog-zones{}` clause does not matter. Initializing the hash table as case-insensitive is not enough to fix this bug. - * `dns/rpz` in the zone update functions, case-sensitive but the domain + * `dns_rpz` in the zone update functions, case-sensitive but the domain names are forced to lower case. - * `isc/tls` for TLS context caches. (case-sensitive) + * `isc_tls` for TLS context caches. (case-sensitive) ## notes Single-threaded. -Case-sensitive and case-insensitive variants, chosen at run-time. +Case-sensitive and case-insensitive variants, chosen at run-time. The +case-insensitive `isc_hash` functions squash the input to lower case before +hasing, instead of using a specialized single-pass case-insensitive hash. It +would be simpler to make the callers handle case-insensitivity since there +are so few of them. Uses chaining, so it is heavy on indirection and heavy on allocation. Modern hash tables use open addressing. ## Ondřej's notes -There's work to do on `isc/ht`: +There's work to do on `isc_ht`: 1. make header-only variant of the hashtable, so we can unify the usage across the codebase (e.g. no extra allocations when storing item) @@ -144,17 +148,17 @@ There's work to do on `isc/ht`: 3. the resizing was added only recently, we still miss shrinking (should be easy enough to do) -`dns/adb` was recently refactored, it used a custom hashtable before +`dns_adb` was recently refactored, it used a custom hashtable before -# `isc/radix` +# `isc_radix` Radix tree for IP address prefix matching ## used by - * `dns/acl` - * `dns/iptable` + * `dns_acl` + * `dns_iptable` ## notes @@ -172,7 +176,7 @@ Uses reserved identifiers for static functions, which is undefined behaviour. -# `isc/symtab` +# `isc_symtab` Another hash table, with another hash function. @@ -186,7 +190,7 @@ Another hash table, with another hash function. Single-threaded. Ought to be unnecessary. Might be worth cleaning up as part of some -general parser refactoring (`isc/lex` could probably be made faster +general parser refactoring (`isc_lex` could probably be made faster using `re2c`). ## Ondřej's notes