For most Web development tasks, chooseObjectorMapIt’s just a matter of personal preference.

However, for developers who care about memory and performance, there are significant differences between objects and maps.

Memory footprint

The engineering-level implementation of Object and Map varies significantly between browsers, but the amount of memory used to store a single key/value pair increases linearly with the number of keys. Adding or removing key/value pairs in batches depends on the engineering implementation of the type of memory allocated by each browser. This varies by browser, but given a fixed size of memory, Map can store approximately 50% more key/value pairs than Object.

Insert performance

Inserting new key/value pairs into Object and Map costs roughly the same, although inserting a Map is generally a little faster in all browsers. For both types, the insertion speed does not increase linearly with the number of key/value pairs. If the code involves a lot of inserts, then clearly the Map performs better.

To find the speed

Unlike insertion, finding key/value pairs from large objects and maps has minimal performance differences, but objects can sometimes be faster if only a few key/value pairs are included. In cases where objects are used as arrays (such as contiguous integers as attributes), the browser engine can be optimized to use a more efficient layout in memory. This is not possible for Map. For both types, lookup speed does not increase linearly with the number of key/value pairs. If your code involves a lot of lookups, it might be better to choose Object in some cases.

Delete the performance

The performance of using delete to remove the Object property has long been criticized, and still is in many browsers. For this reason, there are some pseudo-deletions of object attributes, including setting the attribute value to undefined or NULL. But all too often, this is a nasty or inappropriate compromise. For most browser engines, Map’s delete() operation is faster than insert and lookup. If your code involves a lot of deletions, you should definitely choose Map.

Reference: JavaScript Advanced Programming (4th edition)