Skip to content

Optimize generator with respect to sorting mappings #149

@crisptrutski

Description

@crisptrutski

This is along the same vein as #148, but less drastic and specialized.

See that there have already been thoughts in this direction here: https://github.com/mozilla/source-map/blob/master/lib/source-map/source-map-generator.js#L297-L299

  1. Small gains from keeping mappings always-sorted as an invariant
  2. Especially cheap insertion of mappings when added in-order

Implementation wise this could be implemented by using a custom data type for _mappings.

Some sort of heap, or even a plain array with sorted insertion and using push for mappings beyond maximum seen (line, column).

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