-
Notifications
You must be signed in to change notification settings - Fork 671
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
Why the LRUCache implementation is using Array over the Doubly Linked List with Map? #700
Comments
Because it was copied from another package, relatively simple code, and relatively small bundle size. |
but the Doubly linked List code is not very large, and it is also simple code
|
Reworking this isn't a priority right now, but if you'd like to submit that as a PR we can take a look. Note that one issue with your implementation is that it uses a |
@markerikson I tried but 2 tests are failing because of it. @markerikson @aryaemami59, Do you have any idea, if we can achieve this? |
@kuldeepsinghborana I can take a look, just out of curiosity are you trying to modify the exisiting implementation for |
@aryaemami59 I am trying to modify the existing implementation |
@kuldeepsinghborana Ok I'll take a look. |
fwiw if it's not possible to replicate the existing behaviour with a linked list, I'm sure we'd be open to a new memoiser instead |
Is there any specific reason for using Array instead of Doubly Linked List implementation.
Right now the time complexities for
get
function isO(n)
, and not sure about theset
function complexity asunshift
functions complexity can beO(n)
orO(1)
depending on the JS engine.The text was updated successfully, but these errors were encountered: