Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None

      Description

      When generating source maps, we emit a lot of extra data that is not needed for mapping stacktraces.

      Planck culls a lot of this information out while still being able to successfully map stacktraces, with a big perf gain: Planck loads the smaller source map files instantly rather than seconds. This has been in place for a year now with no reports of issues.

      I'm thinking that we may be able to do the same in ClojureScript proper, when writing out source maps. It's worth trying an experiment where we optionally strip out this information using the function that had been developed for Planck, included here for reference:

      (defn- strip-source-map
        "Strips a source map down to the minimal representation needed for mapping
        stacktraces. This means we only need the :line and :col fields, we only need
        the last element in each vector of such maps, and we can eliminate
        duplicates, taking the smallest col number for each unique value."
        [sm]
        (into {}
          (map (fn [[row cols]]
                 [row (->> cols
                        (map (fn [[col frames]]
                               [col [(select-keys (peek frames) [:line :col])]]))
                        (sort-by first)
                        (distinct-by second)
                        (into {}))]))
          sm))
      

        Attachments

          Activity

            People

            • Assignee:
              mfikes Mike Fikes
              Reporter:
              mfikes Mike Fikes
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: