-
Notifications
You must be signed in to change notification settings - Fork 111
Commit 434c466
authored
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.h1 parent 3a70492 commit 434c466Copy full SHA for 434c466
0 commit comments