Skip to content

Perform fewer memory allocations when creating the data entry list#147

Merged
oschwald merged 7 commits intomasterfrom
will2/fewer-allocations
Nov 2, 2017
Merged

Perform fewer memory allocations when creating the data entry list#147
oschwald merged 7 commits intomasterfrom
will2/fewer-allocations

Conversation

@horgh
Copy link
Contributor

@horgh horgh commented Nov 1, 2017

As mentioned in #142, this is a hotspot. With this PR, we allocate a pool of memory up front to use for this purpose. It grows as needed.

@horgh horgh force-pushed the will2/fewer-allocations branch from e5e53a8 to c7d72c2 Compare November 1, 2017 18:32
This is a performance optimization. Previously we would allocate memory
for each node in the list one at a time with individual calls to
calloc(). This change causes us to allocate 64 up front and then as more
are needed, we double that each time.
@horgh horgh force-pushed the will2/fewer-allocations branch from c7d72c2 to 8d82d03 Compare November 1, 2017 18:37
@oschwald
Copy link
Member

oschwald commented Nov 2, 2017

This looks great! Would you also add an appropriate entry to the change log?

This mentions the reduction in memory allocations in
MMDB_get_entry_data_list().
@oschwald
Copy link
Member

oschwald commented Nov 2, 2017

Closes #142

@oschwald oschwald merged commit ed87663 into master Nov 2, 2017
@oschwald oschwald deleted the will2/fewer-allocations branch November 2, 2017 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants