Page MenuHomePhabricator

[NFC] Reducing allocations in AST attributes

Authored by kevgs on Aug 9 2016, 11:45 AM.



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.

Diff Detail

Event Timeline

kevgs updated this revision to Diff 67382.Aug 9 2016, 11:45 AM
kevgs retitled this revision from to [NFC] Reducing allocations in AST attributes.
kevgs updated this object.
kevgs added reviewers: rsmith, bkramer.
kevgs added a subscriber: cfe-commits.

My test case is:

clang++ -std=c++14 -fsyntax-only

#include <algorithm>
#include <iostream>
#include <vector>
int main() {

std::vector<int> v = {1, 2, 3};
std::for_each(v.begin(), v.end(), [](auto i) { std::cout << i; });
return 0;


kevgs added a comment.Aug 9 2016, 11:46 AM

Btw, ConstAttrVec is never used.

majnemer accepted this revision.Aug 12 2016, 5:10 PM
majnemer added a reviewer: majnemer.
majnemer added a subscriber: majnemer.



Might as well clang-format this line.


I'd delete this.

This revision is now accepted and ready to land.Aug 12 2016, 5:10 PM
kevgs updated this revision to Diff 67955.Aug 12 2016, 9:41 PM
kevgs edited edge metadata.

clang-formatted + dead code removed

kevgs added a comment.Aug 12 2016, 9:42 PM

I have no commit rights.

aaron.ballman closed this revision.Aug 16 2016, 7:56 AM
aaron.ballman added a subscriber: aaron.ballman.

Thank you! I've commit in r278812.