Reusing Linux rbtree outside Linux You may re-use this rbtree implementation in practice For example, to implement malloc A malloc implementation with rbtree is small It is also reasonably fast and scales well Surprisingly, a first-fit implementation is faster if the number of blocks is not exceedingly large And we are back the Pike's programming rules: Rule 1. You can't know where a program is spending its time. Rule 2. Always measure before you optimize. Rule 3. Fancy algorithms are slow when n is small, and n is usually small.