Skip to content

'object' part of Tuple is not 'hoisted' to the start of the trie #10

Description

@acutmore

As per the README

Astute readers may object that some bookkeeping data remains in memory when you create tuple objects with prefixes of primitive values

This can be solved by 'hoisting' the object parts of the key to the front before performing the lookup. i.e.:

Tuple(1, 2, Object);

Tuple(1, Object, 2);

can interally lookup the tuples for:

[Object, 1, 2, Object]

[Object, 1, Object, 2]

This does make the lookup O(2n), but that is still O(n).

Note: this also doesn't only apply to objects, now that https://github.com/tc39/proposal-symbols-as-weakmap-keys is part of the spec, non-registered symbols can also be 'hoisted' to the start of the key too.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions