)]}'
{
  "commit": "24ec910935a7f6c2da1f22db48e198ced0711eaf",
  "tree": "145f2a6e83882331bda401d07357a54d23ccc59f",
  "parents": [
    "3b57ffac0c48c450e99c8316841b84ca41a39309"
  ],
  "author": {
    "name": "nharmata",
    "email": "nharmata@google.com",
    "time": "Mon Mar 07 10:09:02 2022 -0800"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Mon Mar 07 10:12:47 2022 -0800"
  },
  "message": "Two minor memory improvements to `Dict`.\n\n(1) When we are constructing a new `Dict` instance and are in the `Mutability.IMMUTABLE` situation, store `contents` as a `ImmutableMap` not a `LinkedHashMap`. The former suffices and uses less memory. There was already a TODO for this from adonovan@. Unfortunately, this optimization is minor in practice because the common case is that a `Dict` is constructed without `Mutability.IMMUTABLE`, but then `Mutability#freeze` gets called later. Therefore I think the bigger optimization opportunity would be to make it so that call to `Mutability#freeze` would magically go in and replace the `LinkedHashMap` instance with a `ImmutableMap` instance (this is not currently mechanically possible; see the javadoc for `Mutability#freeze`). I added a TODO for this.\n\n(2) Use `Dict#EMPTY` appropriately in all the code paths that construct `Dict` instances to avoid having multiple physical objects all for the same logical concept of \"immutable empty dict\".\n\nPiperOrigin-RevId: 432973333\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9be147b8a0aff30dd81282e4697014c75b4c3c03",
      "old_mode": 33188,
      "old_path": "src/main/java/net/starlark/java/eval/Dict.java",
      "new_id": "b1a0c160adfbda17b247724629ab25c16d20438c",
      "new_mode": 33188,
      "new_path": "src/main/java/net/starlark/java/eval/Dict.java"
    },
    {
      "type": "modify",
      "old_id": "e7cc32c79fa1e2645ee2347eda42b1ba7fc24fa9",
      "old_mode": 33188,
      "old_path": "src/test/java/net/starlark/java/eval/StarlarkMutableTest.java",
      "new_id": "66d02a851f2069b7ef4bbf7666a79e23ef256971",
      "new_mode": 33188,
      "new_path": "src/test/java/net/starlark/java/eval/StarlarkMutableTest.java"
    }
  ]
}
