Skip to content

Mutable API: Specify initialSize independent of capacity#8

Open
bryphe wants to merge 2 commits intopqwy:masterfrom
bryphe:master
Open

Mutable API: Specify initialSize independent of capacity#8
bryphe wants to merge 2 commits intopqwy:masterfrom
bryphe:master

Conversation

@bryphe
Copy link

@bryphe bryphe commented Feb 19, 2020

Hi,

Thank you for the great library!

For my scenario, it'd be preferable to not pre-allocate the capacity when initializing the Lru Hashtable. I'd like to be able to bound the growth, and make guarantees that we do not exceed a certain size, but not necessarily allocate the full set of memory up-front.

This isn't doable with the current API, because the capacity passed to the create method of the Mutable LRU is used to set the initial size of the Hashtbl.t.

To support this, I added an optional initialSize parameter to create - if not specified, it will default to capacity as before. If it is specified, it is used to set the initial size of the underlying hash table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant