craftr-build-4.x icon indicating copy to clipboard operation
craftr-build-4.x copied to clipboard

Reduce CraftrBuildGraph.json size by merging equal environment mappings

Open NiklasRosenstein opened this issue 6 years ago • 0 comments

The environ dictionary is saved for every build action, but often it is the same across many actions (for when using the Cxx MSVC Toolchain). In these cases, we could greatly decrease the size of the JSON file by storing some kind of reference to the environment instead of a new copy for every action. For example

{
  "environs": {
    "342343432": { ... }
  },
  "actions": {
    "myproject@main:cxx.compileC": {"environ": "&342343432", ...}
  }
}

We could use the Python Object ID for the environments if we want to match exacat instances of the environment mapping, but I suppose checking for content equality is more important, for example if at some place a plain copy of the environment is created but not modified.

NiklasRosenstein avatar Mar 20 '18 11:03 NiklasRosenstein