[PATCH] D23329: [NFC] Reducing allocations in AST attributes

Eugene via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 11:45:04 PDT 2016

kevgs created this revision.
kevgs added reviewers: rsmith, bkramer.
kevgs added a subscriber: cfe-commits.

In my test case max resident memory changed from 65760k to 64476k which is 1.9% improvement. 

Allocations in grow_pod changed from 8847 to 4872 according to tcmalloc heap profiler.

Overall running time remained the same.



Index: include/clang/AST/AttrIterator.h
--- include/clang/AST/AttrIterator.h
+++ include/clang/AST/AttrIterator.h
@@ -39,8 +39,8 @@
 namespace clang {
 /// AttrVec - A vector of Attr, which is how they are stored on the AST.
-typedef SmallVector<Attr*, 2> AttrVec;
-typedef SmallVector<const Attr*, 2> ConstAttrVec;
+typedef SmallVector<Attr*, 4> AttrVec;
+typedef SmallVector<const Attr*, 4> ConstAttrVec;
 /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only
 /// providing attributes that are of a specific type.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23329.67382.patch
Type: text/x-patch
Size: 609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160809/04fe9d4a/attachment-0001.bin>

More information about the cfe-commits mailing list