about summary refs log tree commit diff
path: root/include/sys
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2016-08-21 20:06:56 +0000
committerRich Felker <dalias@aerifal.cx>2018-09-20 17:57:47 -0400
commitc50985d5c8e316c5c464f352e79eeebfed1121a9 (patch)
tree46f4250072be1d98f3f98ccd3ae244b4eec5f3f1 /include/sys
parent5ef60206ff9e697d3011bcf48afca50c9fe85e1b (diff)
downloadmusl-c50985d5c8e316c5c464f352e79eeebfed1121a9.tar.gz
musl-c50985d5c8e316c5c464f352e79eeebfed1121a9.tar.xz
musl-c50985d5c8e316c5c464f352e79eeebfed1121a9.zip
new tsearch implementation
Rewrote the AVL tree implementation:

- It is now non-recursive with fixed stack usage (large enough for
worst case tree height). twalk and tdestroy are still recursive as
that's smaller/simpler.

- Moved unrelated interfaces into separate translation units.

- The node structure is changed to use indexed children instead of
left/right pointers, this simplifies the balancing logic.

- Using void * pointers instead of struct node * in various places,
because this better fits the api (node address is passed in a void**
argument, so it is tempting to incorrectly cast it to struct node **).

- As a further performance improvement the rebalancing now stops
when it is not needed (subtree height is unchanged). Otherwise
the behaviour should be the same as before (checked over generated
random inputs that the resulting tree shape is equivalent).

- Removed the old copyright notice (including prng related one: it
should be licensed under the same terms as the rest of the project).

.text size of pic tsearch + tfind + tdelete + twalk:

   x86_64 i386 aarch64  arm mips powerpc ppc64le  sh4 m68k s390x
old   941  899    1220 1068 1852    1400    1600 1008 1008  1488
new   857  881    1040  976 1564    1192    1360  736  820  1408
Diffstat (limited to 'include/sys')
0 files changed, 0 insertions, 0 deletions