)]}'
{
  "commit": "359b01ca8424dcfea9504236365f42b4e0d1aaea",
  "tree": "1a19579c85a8409c665b44696736126e35ef2eef",
  "parents": [
    "e4a4b31577c7419497ac30cebe30d755b97752c5"
  ],
  "author": {
    "name": "Jeff King",
    "email": "peff@peff.net",
    "time": "Mon Jul 11 10:48:06 2022 -0400"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Mon Jul 11 14:27:31 2022 -0700"
  },
  "message": "ref-filter: disable save_commit_buffer while traversing\n\nVarious ref-filter options like \"--contains\" or \"--merged\" may cause us\nto traverse large segments of the history graph. It\u0027s counter-productive\nto have save_commit_buffer turned on, as that will instruct the commit\ncode to cache in-memory the object contents for each commit we traverse.\n\nThis increases the amount of heap memory used while providing little or\nno benefit, since we\u0027re not actually planning to display those commits\n(which is the usual reason that tools like git-log want to keep them\naround). We can easily disable this feature while ref-filter is running.\nThis lowers peak heap (as measured by massif) for running:\n\n  git tag --contains 1da177e4c3\n\nin linux.git from ~100MB to ~20MB. It also seems to improve runtime by\n4-5% (600ms vs 630ms).\n\nA few points to note:\n\n  - it should be safe to temporarily disable save_commit_buffer like\n    this. The saved buffers are accessed through get_commit_buffer(),\n    which treats the saved ones like a cache, and loads on-demand from\n    the object database on a cache miss. So any code that was using this\n    would not be wrong, it might just incur an extra object lookup for\n    some objects. But...\n\n  - I don\u0027t think any ref-filter related code is using the cache. While\n    it\u0027s true that an option like \"--format\u003d%(*contents:subject)\" or\n    \"--sort\u003d*authordate\" will need to look at the commit contents,\n    ref-filter doesn\u0027t use get_commit_buffer() to do so! It always reads\n    the objects directly via read_object_file(), though it does avoid\n    re-reading objects if the format can be satisfied without them.\n\n    Timing \"git tag --format\u003d%(*authordate)\" shows that we\u0027re the same\n    before and after, as expected.\n\n  - Note that all of this assumes you don\u0027t have a commit-graph file. if\n    you do, then the heap usage is even lower, and the runtime is 10x\n    faster. So in that sense this is not urgent, as there\u0027s a much\n    better solution. But since it\u0027s such an obvious and easy win for\n    fallback cases (including commits which aren\u0027t yet in the graph\n    file), there\u0027s no reason not to.\n\nSigned-off-by: Jeff King \u003cpeff@peff.net\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d3c90e5dbe2fdb4cdbad6b93290e27b46e205fbb",
      "old_mode": 33188,
      "old_path": "ref-filter.c",
      "new_id": "bdf39fa761ef9bb961ec03141f35ce71a000c91e",
      "new_mode": 33188,
      "new_path": "ref-filter.c"
    }
  ]
}
