hapijs / catbox-memory

Memory adapter for catbox
Other
33 stars 30 forks source link

Implementing a binary tree for storage and search would improve performance #50

Closed hiddentao closed 7 years ago

hiddentao commented 7 years ago

The module uses the Javascript object (i.e. built-in hash table) to store items. With a very large no. of cache items this will become less efficient than using a binary search tree to store items.

kanongil commented 7 years ago

That seems like a dubious claim. A hash table will have a typical insertion complexity of O(1), while a BST has a fixed O(log(n)).

hiddentao commented 7 years ago

@kanongil I was basing this on code kata I've completed where using a binary tree instead of a hash table saved the day for me. However, having researched this a bit more just now, the mathematical evidence supports your point of view more than mine.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.