-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map enhancement #144
Map enhancement #144
Conversation
a4c11da
to
e641047
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squash the commits and emphasize the benefits of this proposed change.
You shall utilize |
Let's synchronize with the implementation in rbtree_bench. |
I may need to rewrite a good commit message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exclude the generated map.h.gch
(pre-compiled header).
{ | ||
node->parent_color = (unsigned long) parent | color; | ||
return (map_node_t *) (((uintptr_t) node->right_red) & ~3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evaluate torvalds/linux@b0687c1 and integrate into this pull request (as another commit).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think it is a good idea.
In linux the usage rb_set_black
is only used to set node from red to black.
However, the map rb_node_set_red
we implemented can set node from any state to black.
If we change the interface, we will cause a lot of unneeded branch that hurts the performance.
Useful prompts for ChatGPT:
|
803047f
to
85c87cf
Compare
e385b4b
to
2498bce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revise the git commit message as How to Write a Git Commit Message suggested.
You shall describe the experimental environment where you perform.
Append the folowing:
|
70efb84
to
6fb4448
Compare
The performance of block_insert and block_find operations in rv32emu experiences significant improvements when replacing the original map with the proposed map implementation. The proposed map implementation shows significant improvements over the original version. The following data represents the average time of 20 experiments, each involving the insertion, finding, and deletion of 10 million randomly generated nodes in a random order. 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 also improved 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
Thank @ypaskell for contributing! |
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
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
The enhancement information as GitHub page - rb_bench.
Correctness tested is provided.
Issue #29