)]}' { "commit": "07854239257cc3eff8759503246595d2629f9367", "tree": "b55ad7e85222381c37bc143d7f45187e9a469be6", "parents": [ "992e927e217baa8a74e6e2c5d7417cb65cf24824" ], "author": { "name": "David \u0027Digit\u0027 Turner", "email": "digit@google.com", "time": "Mon Feb 03 18:12:12 2020 +0100" }, "committer": { "name": "Commit Bot", "email": "commit-bot@chromium.org", "time": "Wed Mar 11 17:25:40 2020 +0000" }, "message": "Reduce RAM usage and improve speed of \"gn gen\"\n\nThis CL continues previous optimization work [1] to improve\nGN\u0027s speed and RAM usage, especially for the Zircon build\n(see [2] for measurements).\n\nIt consists in the following changes:\n\n- Introduce src/gn/hash_table_base.h to generalize\n the fast hash table used by StringAtom\u0027s implementation\n through a custom template class, and document its\n usage properly (with a disclaimer not to use it\n unless profiling shows it\u0027s worthwhile).\n\n- Use it to simplify and optimize the implementation\n of the UniqueVector\u003c\u003e template.\n\n- Implement SourceDir and Label with StringAtom instead\n of std::string instances.\n\n+ Remove a small unwanted const Label copy in\n src/gn/analyzer.cc\n\n[1] https://gn-review.googlesource.com/c/gn/+/7280\n\n[2] Measurement results for \"gn gen\" runs on my\n local machine, both using recent Chromium and Fuchsia\n source checkouts.\n\n CHROMIUM: RAM saved: 68 MiB Speedup: 8.4%\n ZIRCON: RAM saved: 405 MiB Speedup: 24.5%\n\n// CHROMIUM BEFORE\n\n/work/chromium0/src$ repeat_cmd 5 /tmp/gn-master gen out/default/\nDone. Made 12150 targets from 2121 files in 4256ms\nDone. Made 12150 targets from 2121 files in 4218ms\nDone. Made 12150 targets from 2121 files in 4286ms\nDone. Made 12150 targets from 2121 files in 4201ms *\nDone. Made 12150 targets from 2121 files in 4244ms\n\n/work/chromium0/src$ /usr/bin/time -v /tmp/gn-master gen out/default\nMaximum resident set size (kbytes): 535480\n\n// CHROMIUM AFTER\n\n/work/chromium0/src$ repeat_cmd 5 /tmp/gn-after gen out/default/\nDone. Made 12150 targets from 2121 files in 3992ms\nDone. Made 12150 targets from 2121 files in 3874ms *\nDone. Made 12150 targets from 2121 files in 3951ms\nDone. Made 12150 targets from 2121 files in 3907ms\nDone. Made 12150 targets from 2121 files in 3905ms\n\n/work/chromium0/src$ /usr/bin/time -v /tmp/gn-after gen out/default\nMaximum resident set size (kbytes): 466056\n\n// ZIRCON BEFORE\n\n/work/fuchsia0$ repeat_cmd 5 /tmp/gn-master gen --root\u003dzircon out/default.zircon\nDone. Made 47910 targets from 782 files in 8915ms *\nDone. Made 47910 targets from 782 files in 8945ms\nDone. Made 47910 targets from 782 files in 9141ms\nDone. Made 47910 targets from 782 files in 9094ms\nDone. Made 47910 targets from 782 files in 9512ms\n\n/work/fuchsia0$ /usr/bin/time -v /tmp/gn-master gen --root\u003dzircon out/default.zircon\nMaximum resident set size (kbytes): 1595364\n\n// ZIRCON AFTER\n\n/work/fuchsia0$ repeat_cmd 5 /tmp/gn-after gen --root\u003dzircon out/default.zircon\nDone. Made 47910 targets from 782 files in 7156ms *\nDone. Made 47910 targets from 782 files in 7715ms\nDone. Made 47910 targets from 782 files in 7327ms\nDone. Made 47910 targets from 782 files in 7491ms\nDone. Made 47910 targets from 782 files in 7573ms\n\n/work/fuchsia0$ /usr/bin/time -v /tmp/gn-master gen --root\u003dzircon out/default.zircon\nMaximum resident set size (kbytes): 1180640\n\nChange-Id: Id315564a9b2285cd89ca07cd69962f008439c9fb\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/7340\nReviewed-by: Brett Wilson \u003cbrettw@chromium.org\u003e\nReviewed-by: Brett Wilson \u003cbrettw@google.com\u003e\nCommit-Queue: Brett Wilson \u003cbrettw@chromium.org\u003e\n", "tree_diff": [ { "type": "modify", "old_id": "0911f3537da2455c99bd1dc1a6c2be2eaa03b4df", "old_mode": 33261, "old_path": "build/gen.py", "new_id": "758c51aef953195891fa6fa989afd03e3d5a4891", "new_mode": 33261, "new_path": "build/gen.py" }, { "type": "modify", "old_id": "c269af7021de227f65c7fda19ed8a7c0aec5e552", "old_mode": 33188, "old_path": "src/gn/analyzer.cc", "new_id": "11fb1118082435cceb19fa9fc5b8c2ae232e6025", "new_mode": 33188, "new_path": "src/gn/analyzer.cc" }, { "type": "modify", "old_id": "4beabc09450ad7c5114c72220a346beb95755c64", "old_mode": 33188, "old_path": "src/gn/filesystem_utils.cc", "new_id": "fee2596dee664b06d3a4cbd04f53b598ef64404d", "new_mode": 33188, "new_path": "src/gn/filesystem_utils.cc" }, { "type": "modify", "old_id": "e359b9f24df281371bc07e570a69192dc7541830", "old_mode": 33188, "old_path": "src/gn/filesystem_utils.h", "new_id": "830478a5fcd46cd21904d3cc55e45c5343aa8563", "new_mode": 33188, "new_path": "src/gn/filesystem_utils.h" }, { "type": "add", "old_id": "0000000000000000000000000000000000000000", "old_mode": 0, "old_path": "/dev/null", "new_id": "9e43733b9376def2085796e775dfafe3b80ba4c5", "new_mode": 33188, "new_path": "src/gn/hash_table_base.h" }, { "type": "add", "old_id": "0000000000000000000000000000000000000000", "old_mode": 0, "old_path": "/dev/null", "new_id": "a4c3244af5c401edb00382463ed04066f4da5ae2", "new_mode": 33188, "new_path": "src/gn/hash_table_base_unittest.cc" }, { "type": "modify", "old_id": "4811196fcb99780750b324ea384d28a34f60f6ae", "old_mode": 33188, "old_path": "src/gn/label.cc", "new_id": "173c3d5bf1bcc534e90c0f0282aa861e72cda919", "new_mode": 33188, "new_path": "src/gn/label.cc" }, { "type": "modify", "old_id": "c2668282800ef55b886d7a35fd49bc933f5d6aff", "old_mode": 33188, "old_path": "src/gn/label.h", "new_id": "95234c9c74c8fa9d1fe4d0ced10f84d3f794739c", "new_mode": 33188, "new_path": "src/gn/label.h" }, { "type": "modify", "old_id": "dd66688c55ba2af5ab9c985e300c28b641ed3666", "old_mode": 33188, "old_path": "src/gn/source_dir.cc", "new_id": "ce92cf22c78fd6bbdd85b816fde641c5944b04b0", "new_mode": 33188, "new_path": "src/gn/source_dir.cc" }, { "type": "modify", "old_id": "ed4b1e323aea9e496f0a840ea1016d8e77a5130d", "old_mode": 33188, "old_path": "src/gn/source_dir.h", "new_id": "9dd847c53ea2984b939e46f7c61d7cc789cf8e4d", "new_mode": 33188, "new_path": "src/gn/source_dir.h" }, { "type": "modify", "old_id": "c310ffd8b28cccb952fcc37bf940d3a5264b3f16", "old_mode": 33188, "old_path": "src/gn/string_atom.cc", "new_id": "fe1ef7382cdec80f504dd76d809805c32c514418", "new_mode": 33188, "new_path": "src/gn/string_atom.cc" }, { "type": "modify", "old_id": "c53ed3a4913d3afaf52a20f926b38230f38bdc10", "old_mode": 33188, "old_path": "src/gn/unique_vector.h", "new_id": "ce5380b275e91fb4eff131f7b9ce6a0bbf5f2265", "new_mode": 33188, "new_path": "src/gn/unique_vector.h" } ] }