)]}' { "commit": "e2345a893fbb902761a40e4ec4b30f26c84480ff", "tree": "5d82de7a9029887b42b6e1e310367bdfa228e79a", "parents": [ "a331a36c92c01ae459158660a4d1bf4c913f0335" ], "author": { "name": "David \u0027Digit\u0027 Turner", "email": "digit@google.com", "time": "Sat Mar 26 18:08:44 2022 +0100" }, "committer": { "name": "Commit Bot", "email": "commit-bot@chromium.org", "time": "Fri Apr 15 15:36:03 2022 +0000" }, "message": "Add ImmutableVector and ImmutableVectorView templates.\n\nThese templates allow creating and using heap-allocated but\nimmutable arrays of items. They will be used by future CLs\nin a few key classes to reduce GN RAM usage drastically.\n\nHere\u0027s how an ImmutableVector compares to an std::vector\u003c\u003e\nin terms of memory usage:\n\n- An empty instance is just an 8-byte null pointer, vs 24 bytes\n for an empty vector.\n\n- Its heap block is sized precisely to fit the instance\u0027s size,\n while the std::vector\u003c\u003e will generally over-allocate its\n storage space (calling reserve() does not guarantee minimal\n heap usage).\n\nNote that constructing an non-empty ImmutableVector requires a\nsource container (std::vector\u003c\u003e or otherwise), or a callable\nthat can produce a fixed number of items for in-place\nconstruction (see source code for details).\n\nAn ImmutableVectorView is a non-owning reference to an\nImmutableVectorView, it is copyable and movable since the\nvector is immutable.\n\nBug: None\nChange-Id: I2cb669b7b0fab777bc7067ee7529690b300ea735\nReviewed-on: https://gn-review.googlesource.com/c/gn/+/13621\nReviewed-by: Sylvain Defresne \u003csdefresne@chromium.org\u003e\nCommit-Queue: David Turner \u003cdigit@google.com\u003e\n", "tree_diff": [ { "type": "modify", "old_id": "8b833d0415dfd0a0acfb8d5935cdb75772e47054", "old_mode": 33261, "old_path": "build/gen.py", "new_id": "f695ccdebd93de2bbf5de02090d0ac244543245c", "new_mode": 33261, "new_path": "build/gen.py" }, { "type": "add", "old_id": "0000000000000000000000000000000000000000", "old_mode": 0, "old_path": "/dev/null", "new_id": "306819b41fc8689b2dbea32a8ed2c740f7c25961", "new_mode": 33188, "new_path": "src/gn/immutable_vector.h" }, { "type": "add", "old_id": "0000000000000000000000000000000000000000", "old_mode": 0, "old_path": "/dev/null", "new_id": "3561ed24c46a2069f5b5230a96ea5eb1bc8a954b", "new_mode": 33188, "new_path": "src/gn/immutable_vector_unittest.cc" } ] }