Update uthash.h to permit preallocation#274
Open
sbergercnmc wants to merge 1 commit intotroydhanson:masterfrom
Open
Update uthash.h to permit preallocation#274sbergercnmc wants to merge 1 commit intotroydhanson:masterfrom
sbergercnmc wants to merge 1 commit intotroydhanson:masterfrom
Conversation
Placed HASH_INITIAL_NUM_BUCKETS and HASH_INITIAL_NUM_BUCKETS_LOG2 into a #ifndef block so as to permit these values to be optionally defined in other code before inclusion of uthash.h and thus permit preallocation of hashtable when a lot of keys are expected to be added.
Collaborator
|
Seems plausible at first glance. Obvious questions:
|
Author
|
Doing this for my use case, where I am loading over 300,000,000 keys (uint64_t), my program's loading time goes from 178 seconds to 93 seconds... Agreed that same idea can be applied to HASH_BKT_CAPACITY_THRESH, but I haven't needed this for my use case. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Placed HASH_INITIAL_NUM_BUCKETS and HASH_INITIAL_NUM_BUCKETS_LOG2 into a #ifndef block so as to permit these values to be optionally defined in other code before inclusion of uthash.h and thus permit preallocation of hashtable when a lot of keys are expected to be added.