Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve map by re-implementing red-black tree (#144)
The proposed map implementation demonstrates substantial improvements compared to the original one by replacing it with a faster red-black tree. The data provided below represents the average time of 20 experiments, each involving the insertion, finding, and deletion of 10 million randomly generated nodes in a random order. These tests were conducted on Apple M1 Pro. OpType | Insert (ns) | Find (ns) | Remove (ns) ---------+---------------+-------------+------------ original | 824,515,450 | 21,132,350 | 925,074,950 proposed | 535,518,250 | 10,032,300 | 602,755,100 ---------+---------------+-------------+------------ improved | 35 % | 52 % | 35 % Heap memory usage has also been reduced by 17%. This map implementation has undergone extensive modifications, heavily relying on the rb.h header file from jemalloc. The original rb.h file served as the foundation and source of inspiration for adapting and tailoring it specifically for this map implementation. Therefore, credit and sincere thanks are extended to jemalloc for their invaluable work. Reference: https://github.com/jemalloc/jemalloc/blob/dev/include/jemalloc/internal/rb.h
- Loading branch information