)]}'
{
  "commit": "0a0fbbe3ff2090fb3eb0003744c045dc38670fa2",
  "tree": "04f698a8f1a60b3b7a88312449f7b60f2acd9bef",
  "parents": [
    "09b2aa30c916bd6facb47a06711755f043b6f37e"
  ],
  "author": {
    "name": "Patrick Steinhardt",
    "email": "ps@pks.im",
    "time": "Tue Aug 25 12:35:24 2020 +0200"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Tue Aug 25 15:34:42 2020 -0700"
  },
  "message": "refs: remove lookup cache for reference-transaction hook\n\nWhen adding the reference-transaction hook, there were concerns about\nthe performance impact it may have on setups which do not make use of\nthe new hook at all. After all, it gets executed every time a reftx is\nprepared, committed or aborted, which linearly scales with the number of\nreference-transactions created per session. And as there are code paths\nlike `git push` which create a new transaction for each reference to be\nupdated, this may translate to calling `find_hook()` quite a lot.\n\nTo address this concern, a cache was added with the intention to not\nrepeatedly do negative hook lookups. Turns out this cache caused a\nregression, which was fixed via e5256c82e5 (refs: fix interleaving hook\ncalls with reference-transaction hook, 2020-08-07). In the process of\ndiscussing the fix, we realized that the cache doesn\u0027t really help even\nin the negative-lookup case. While performance tests added to benchmark\nthis did show a slight improvement in the 1% range, this really doesn\u0027t\nwarrent having a cache. Furthermore, it\u0027s quite flaky, too. E.g. running\nit twice in succession produces the following results:\n\nTest                         master            pks-reftx-hook-remove-cache\n--------------------------------------------------------------------------\n1400.2: update-ref           2.79(2.16+0.74)   2.73(2.12+0.71) -2.2%\n1400.3: update-ref --stdin   0.22(0.08+0.14)   0.21(0.08+0.12) -4.5%\n\nTest                         master            pks-reftx-hook-remove-cache\n--------------------------------------------------------------------------\n1400.2: update-ref           2.70(2.09+0.72)   2.74(2.13+0.71) +1.5%\n1400.3: update-ref --stdin   0.21(0.10+0.10)   0.21(0.08+0.13) +0.0%\n\nOne case notably absent from those benchmarks is a single executable\nsearching for the hook hundreds of times, which is exactly the case for\nwhich the negative cache was added. p1400.2 will spawn a new update-ref\nfor each transaction and p1400.3 only has a single reference-transaction\nfor all reference updates. So this commit adds a third benchmark, which\nperforms an non-atomic push of a thousand references. This will create a\nnew reference transaction per reference. But even for this case, the\nnegative cache doesn\u0027t consistently improve performance:\n\nTest                         master            pks-reftx-hook-remove-cache\n--------------------------------------------------------------------------\n1400.4: nonatomic push       6.63(6.50+0.13)   6.81(6.67+0.14) +2.7%\n1400.4: nonatomic push       6.35(6.21+0.14)   6.39(6.23+0.16) +0.6%\n1400.4: nonatomic push       6.43(6.31+0.13)   6.42(6.28+0.15) -0.2%\n\nSo let\u0027s just remove the cache altogether to simplify the code.\n\nSigned-off-by: Patrick Steinhardt \u003cps@pks.im\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "836d49b9588dfc5e7eafe908654f02b4aaf93607",
      "old_mode": 33188,
      "old_path": "refs.c",
      "new_id": "d4ec7d30c126d408ca088f6bdd4e67a227e99dbd",
      "new_mode": 33188,
      "new_path": "refs.c"
    },
    {
      "type": "modify",
      "old_id": "d275a81248b04adaab5e37ea20504a82d572e649",
      "old_mode": 33261,
      "old_path": "t/perf/p1400-update-ref.sh",
      "new_id": "ce5ac3ed85e10efc2b4dd784e5d8949d8f269a75",
      "new_mode": 33261,
      "new_path": "t/perf/p1400-update-ref.sh"
    }
  ]
}
