)]}'
{
  "commit": "6767e99aea9e7c32b6fc421ad3271ab99a82ca78",
  "tree": "ee0ed4d7bc9025fbf82f612160bb3ea2ed3a9e5b",
  "parents": [
    "47b40ef49e678319c0dac767a95a363cc3f1f6cb"
  ],
  "author": {
    "name": "Takuto Ikuta",
    "email": "tikuta@google.com",
    "time": "Wed Feb 25 15:35:03 2026 +0900"
  },
  "committer": {
    "name": "GN LUCI",
    "email": "gn-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Wed Feb 25 17:36:03 2026 -0800"
  },
  "message": "Optimize HeaderChecker by parallelizing ReachabilityCache pre-calculation and removing lock contention.\n\nThis change introduces a pre-calculation phase in HeaderChecker::Run\nthat concurrently populates the ReachabilityCache for all relevant\ntargets using a WorkerPool. It also eliminates lock contention during\nthe file-checking phase by using atomic completion flags and a lock-free\nfast path in ReachabilityCache::SearchForDependencyTo.\n\nKey optimizations:\n- Concurrent BFS pre-calculation during HeaderChecker::Run.\n- Reusing the WorkerPool across pre-calculation and file-checking phases.\n- Lock-free dependency lookup using std::atomic\u003cbool\u003e completion flags\n  with acquire/release semantics in the common case where the cache is warm.\n- Significantly reduces lock contention (shared_mutex) on macOS.\n\nVerified with existing HeaderChecker unittests and profiling on\nChromium.\n\nBenchmark 1: ./gn_main gen --root\u003d/Users/tikuta/chromium/src --check\n/Users/tikuta/chromium/src/out/no_clang_modules\n  Time (mean ± σ):      6.306 s ±  0.025 s    [User: 27.219 s, System: 21.382 s]\n  Range (min … max):    6.283 s …  6.333 s    5 runs\n\nBenchmark 2: ./gn_optimized gen --root\u003d/Users/tikuta/chromium/src\n--check /Users/tikuta/chromium/src/out/no_clang_modules\n  Time (mean ± σ):      6.083 s ±  0.024 s    [User: 27.499 s, System: 26.226 s]\n  Range (min … max):    6.049 s …  6.112 s    5 runs\n\nSummary\n  ./gn_optimized gen --root\u003d/Users/tikuta/chromium/src --check /Users/tikuta/chromium/src/out/no_clang_modules ran\n    1.04 ± 0.01 times faster than ./gn_main gen --root\u003d/Users/tikuta/chromium/src --check /Users/tikuta/chromium/src/out/no_clang_modules\n\nBug: 484862257\nChange-Id: I4c9609f0b57693a1a209f4c36b810bb1597a39a9\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/21260\nReviewed-by: David Turner \u003cdigit@google.com\u003e\nReviewed-by: Sylvain Defresne \u003csdefresne@chromium.org\u003e\nCommit-Queue: Takuto Ikuta \u003ctikuta@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "aba451bf9e1f62f0ec32d616c4326835f9e36a86",
      "old_mode": 33188,
      "old_path": "src/gn/header_checker.cc",
      "new_id": "804489672769fbd7091c386ba9e89a11399e7696",
      "new_mode": 33188,
      "new_path": "src/gn/header_checker.cc"
    },
    {
      "type": "modify",
      "old_id": "083272fd86b99cccdff444850cc10551f9183b17",
      "old_mode": 33188,
      "old_path": "src/gn/header_checker.h",
      "new_id": "c3c688b66533ec2a7c8adb9dede466cde6246f31",
      "new_mode": 33188,
      "new_path": "src/gn/header_checker.h"
    }
  ]
}
