Open Bug 1558351 Opened 5 years ago Updated 2 years ago

ES6 Map usage in Network panels' redux state add overhead

Categories

(DevTools :: Netmonitor, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: Harald, Unassigned)

References

(Blocks 2 open bugs)

Details

The sweet spot for Map/Set is mutability. For immutable use cases like redux they are not well optimized. They also add GC/CC overhead as they are not handled by the nursery.

Bugbug thinks this bug is a task, but please change it back in case of error.

Type: defect → task

Objects are very aggressively optimized because everything relies on objects being fast.

They're especially tuned for these cases:

  • creating many objects with the same keys, especially some fixed smallish number of keys (e.g. many instances of a class; object literals; same-shaped objects created by JSON.parse)
  • property reads and writes using the syntax obj.prop, where the field name prop is right there in the source code, so we know it won't change
  • array-like usage, with small nonnegative integers as the keys

Maps aren't really optimized. They're sometimes more convenient to hack with than objects. They don't need to be much worse than objects when you don't have any of the cases above, i.e. the data you're storing, and your data access patterns, are at least a little random. Or you have a lot of data. But we haven't tried very hard.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.