Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Implement MicroMap #1201

Open
Open
@mhevery

Description

@mhevery

Maps are used often in Angular. Most of the maps have fewer than 20 keys, yet they create many objects. For small maps it is more efficient to do a linear search of fields than to do full bucket algorithm. See: mhevery@3290683 This test shows that break even point in Dart VM is 3 fields and Dart2JS is 17 fields.

Create a class MicroMap (also MicroMapIdentity) which implements Map interface but which if it has less than 20 keys it will use fields but if more than 20 it will create a real HashMap delegate and forward all of the calls to the delegate. (Also move the contents of the fields there.) This way we can take advantage of the efficient storage MicroMap but auto move to real map as needed.

Not all methods need to be implemented. Just the basics such as read, write, remove, length.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions