-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
[v5.1] [Heap Trace Standalone] hash map uses doubly linked list, but single linked would be better (IDFGH-9846) #11173
Comments
I edited this issue. Hopefully your internal issue tracker supports edits. |
Note, the records themselves are doubly linked because:
But the hash map does not need this feature. Also, because the hash map should be large as possible to avoid collisions, we care more that each entry is as small as possible. |
Hi @chipweinberger, thanks for reporting this. It is true that we could use a singly linked list in the hashmap. I will update the feature and get back to you with perf results. |
So it seems that the |
STAILQ is more appropriate than SLIST. (my bad) STAILQ lets you remove from the end in O(1) SLIST lets you remove from the begining in O(1) |
|
Ya, thats a good point. Looking at the code, you are right. Closing this. |
We actually could support this. To use SLIST (saving 50% of the ram!) without hurting perf, we need to replace This would require a small code change.
|
Hi @chipweinberger, I am finally back from my extended leave! I will take a look at that idea as soon as I can :) I'll keep you posted! |
Wow nice to hear from you! I was wondering what happened to you =P Hope you enjoyed your time off! |
yes I did very much! I was on paternity leave :) |
@chipweinberger , I had a look at the code. I am not sure I follow you here. Are you suggesting to make only hash_map a singly linked list? |
correct
|
I will update hash_map to a singly linked list. |
The update of the hash map was merged internally. |
awesome! glad it worked out! |
the update will be available on next github sync. I will close the issue now. |
Previously, the hash map was a doubly linked list but was never using the characteristics of it. This commit switches the hash map to a singly linked list instead This commit also fixes memory leak in heap trace tests by setting hashmap size to 10 for the tests (instead of the default value of 250) See #11173
Previously, the hash map was a doubly linked list but was never using the characteristics of it. This commit switches the hash map to a singly linked list instead This commit also fixes memory leak in heap trace tests by setting hashmap size to 10 for the tests (instead of the default value of 250) See espressif#11173
@SoucheSouche
Again, thanks for your work on this PR.
It looks like the hash map entries are storing a doubly linked list. i.e. TAILQ
AFAICT, a singly linked list is all we need, and would save 50% of the memory.
SLIST_HEAD(heap_trace_record_list_struct_t, heap_trace_record_t*);
Thanks again.
The text was updated successfully, but these errors were encountered: