)]}'
{
  "commit": "185124551408e7a5349c2aa31051b5a629dc3a5e",
  "tree": "0779dfd8cd9dde5878394b77b979d1b21b325541",
  "parents": [
    "90294ccdcf9334ed25a76ac9b67689468e506342"
  ],
  "author": {
    "name": "David \u0027Digit\u0027 Turner",
    "email": "digit@google.com",
    "time": "Fri Nov 05 16:57:52 2021 +0100"
  },
  "committer": {
    "name": "Commit Bot",
    "email": "commit-bot@chromium.org",
    "time": "Mon Nov 15 16:27:36 2021 +0000"
  },
  "message": "Remove type_ member from SourceFile type\n\nIn order to reduce GN\u0027s peak RAM usage by 5%, this CL\nremoves the SourceFile::type_ member entirely, relying\ninstead of SourceFile::GetType() and SourceFile::IsFooType()\nmethods to get the same information.\n\nProfiling shows that a very large number of SourceFile instances\nare used at \"gn gen\" time, mostly due to the fact that SourceFileSet\nmerges are performed extensively during this operation. The type\nvalue can be recomputed on the fly, with a slightly optimized\nGetSourceFilePath() implementation, or compared with\nSourceFile::IsFooType() methods as well.\n\nMeasurements on the Fuchsia source tree, and a version of GN built\nwith a recent Clang toolchain, linked to rpmalloc, with ICF and LTO\nenabled shows that:\n\n  - Peak RAM usage goes from 4 GiB to 3.8 GiB (medians of 3 runs):\n\n       /usr/bin/time -f%M /tmp/gn-xx gen out/default\n         BEFORE: 4018648\n         AFTER:  3794956\n         DIFF:    223692\n\n  - Overall \"gn gen\" time improves by half a second (medians of 9 runs):\n\n       /tmp/gn-xx gen out/default\n         BEFORE: Done. Made 173241 targets from 5370 files in 18229ms\n         AFTER:  Done. Made 173241 targets from 5370 files in 17761ms\n         DIFF:   468ms\n\nFor a Chromium build, no significant difference in \"gn gen\" time,\nbut 20 MiB or peak RAM, out of 770 MiB, are saved.\n\n+ Change std::hash\u003cSourceFile\u003e implementation to use pointer hashing\n  instead of string hashing. This doesn\u0027t have a significant performance\n  impact, since this method is rarely used (in the\n  InputFileManager::InputFileMap type only).\n\nChange-Id: I79bd35d4add840ee90bc271564f5e127658db10a\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/12380\nCommit-Queue: David Turner \u003cdigit@google.com\u003e\nReviewed-by: Brett Wilson \u003cbrettw@chromium.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "485884e81bf3e55a8b3949e6d2d935333b8d2a47",
      "old_mode": 33188,
      "old_path": "src/gn/binary_target_generator.cc",
      "new_id": "4cac96f97ad3690f7a0d4ac6fa46611ad98298e7",
      "new_mode": 33188,
      "new_path": "src/gn/binary_target_generator.cc"
    },
    {
      "type": "modify",
      "old_id": "74f69903076b852be6314855e0b5e108a37187e3",
      "old_mode": 33188,
      "old_path": "src/gn/compile_commands_writer.cc",
      "new_id": "c0b94d1f15e1ba2a60ab90a26b6dc8a083b8e0cd",
      "new_mode": 33188,
      "new_path": "src/gn/compile_commands_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "212f5816dc8426cd65625a358c8a8a4b19caa00f",
      "old_mode": 33188,
      "old_path": "src/gn/header_checker.cc",
      "new_id": "32f4d90c4564ff21293af962489ba01202cd90b5",
      "new_mode": 33188,
      "new_path": "src/gn/header_checker.cc"
    },
    {
      "type": "modify",
      "old_id": "b26171ad6597fade3b9424eb84bfd72d16282dbe",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_binary_target_writer.cc",
      "new_id": "48f485ad1813029ff6b1a7fb4498bb89acbb6fbf",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_binary_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "cd76a1684d8efe8036cfacfe56b01d76da54cd9e",
      "old_mode": 33188,
      "old_path": "src/gn/ninja_c_binary_target_writer.cc",
      "new_id": "d9c3ad2f894a1f6eca8fec66de5f3eb738a86c21",
      "new_mode": 33188,
      "new_path": "src/gn/ninja_c_binary_target_writer.cc"
    },
    {
      "type": "modify",
      "old_id": "52066d76f07c2851a5e41263501aca662b92325c",
      "old_mode": 33188,
      "old_path": "src/gn/source_file.cc",
      "new_id": "f9d816a47ae6a830a6469e2e68a69e8010d9d7a3",
      "new_mode": 33188,
      "new_path": "src/gn/source_file.cc"
    },
    {
      "type": "modify",
      "old_id": "5ad8f6279b4206d2f660fd5d2f3d6af67ca8e636",
      "old_mode": 33188,
      "old_path": "src/gn/source_file.h",
      "new_id": "b13a4002dd41da8cc46ce7cb2c4632c1f0aa6b6f",
      "new_mode": 33188,
      "new_path": "src/gn/source_file.h"
    },
    {
      "type": "modify",
      "old_id": "9d3a12333d19f0caff4017ff29166b56b419adff",
      "old_mode": 33188,
      "old_path": "src/gn/source_file_unittest.cc",
      "new_id": "6c409b1b93205b5c39263d1f2716f95ed2b537a0",
      "new_mode": 33188,
      "new_path": "src/gn/source_file_unittest.cc"
    },
    {
      "type": "modify",
      "old_id": "c15e319bb5b0e720d52f9373332b883a34abbaf7",
      "old_mode": 33188,
      "old_path": "src/gn/swift_values.cc",
      "new_id": "a9677a622af97969d8b977a051ff75f5023b5703",
      "new_mode": 33188,
      "new_path": "src/gn/swift_values.cc"
    },
    {
      "type": "modify",
      "old_id": "66ffc1f349cae76ec3fb4e4848e339349358b028",
      "old_mode": 33188,
      "old_path": "src/gn/target.cc",
      "new_id": "70713575429b97e15c87b575622a031f6d3abec2",
      "new_mode": 33188,
      "new_path": "src/gn/target.cc"
    }
  ]
}
