)]}'
{
  "commit": "f8b2314c563be4366f645536e8031a132cfdf3dd",
  "tree": "92e58c2b2ecb5936a044f20c4d82e72c5b010a47",
  "parents": [
    "d211c2d3774d78173e004f0ffb1e2eae9ae19706"
  ],
  "author": {
    "name": "Austin Clements",
    "email": "austin@google.com",
    "time": "Thu Sep 22 17:08:37 2016 -0400"
  },
  "committer": {
    "name": "Austin Clements",
    "email": "austin@google.com",
    "time": "Mon Sep 26 22:01:35 2016 +0000"
  },
  "message": "runtime: optimize defer code\n\nThis optimizes deferproc and deferreturn in various ways.\n\nThe most important optimization is that it more carefully arranges to\nprevent preemption or stack growth. Currently we do this by switching\nto the system stack on every deferproc and every deferreturn. While we\nneed to be on the system stack for the slow path of allocating and\nfreeing defers, in the common case we can fit in the nosplit stack.\nHence, this change pushes the system stack switch down into the slow\npaths and makes everything now exposed to the user stack nosplit. This\nalso eliminates the need for various acquirem/releasem pairs, since we\nare now preventing preemption by preventing stack split checks.\n\nAs another smaller optimization, we special case the common cases of\nzero-sized and pointer-sized defer frames to respectively skip the\ncopy and perform the copy in line instead of calling memmove.\n\nThis speeds up the runtime defer benchmark by 42%:\n\nname           old time/op  new time/op  delta\nDefer-4        75.1ns ± 1%  43.3ns ± 1%  -42.31%   (p\u003d0.000 n\u003d8+10)\n\nIn reality, this speeds up defer by about 2.2X. The two benchmarks\nbelow compare a Lock/defer Unlock pair (DeferLock) with a Lock/Unlock\npair (NoDeferLock). NoDeferLock establishes a baseline cost, so these\ntwo benchmarks together show that this change reduces the overhead of\ndefer from 61.4ns to 27.9ns.\n\nname           old time/op  new time/op  delta\nDeferLock-4    77.4ns ± 1%  43.9ns ± 1%  -43.31%  (p\u003d0.000 n\u003d10+10)\nNoDeferLock-4  16.0ns ± 0%  15.9ns ± 0%   -0.39%    (p\u003d0.000 n\u003d9+8)\n\nThis also shaves 34ns off cgo calls:\n\nname       old time/op  new time/op  delta\nCgoNoop-4   122ns ± 1%  88.3ns ± 1%  -27.72%  (p\u003d0.000 n\u003d8+9)\n\nUpdates #14939, #16051.\n\nChange-Id: I2baa0dea378b7e4efebbee8fca919a97d5e15f38\nReviewed-on: https://go-review.googlesource.com/29656\nReviewed-by: Keith Randall \u003ckhr@golang.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "787c4300dd99cbe16abfb8b4d23053b8ece6fa68",
      "old_mode": 33188,
      "old_path": "src/runtime/panic.go",
      "new_id": "9e456372b352b72b769bb175f127b885f8dff271",
      "new_mode": 33188,
      "new_path": "src/runtime/panic.go"
    }
  ]
}
