[llvm-exegesis] Analysis::writeSnippet(): be smarter about memory allocations.
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 19 Nov 2018 13:28:14 +0000 (13:28 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 19 Nov 2018 13:28:14 +0000 (13:28 +0000)
commitf8b28e9bf4720fc737d4db0985f0d173e3b4f2fa
tree80dc0ae8c6bcab9be841aeacd5ddc373baf5fc7f
parent0b4b512826c7331542348706d7374632c6ea45a0
[llvm-exegesis] Analysis::writeSnippet(): be smarter about memory allocations.

Summary:
Test data: 500kLOC of benchmark.yaml, 23Mb. (that is a subset of the actual uops benchmark i was trying to analyze!)
Old time: (D54381)
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null

real    0m10.487s
user    0m9.745s
sys     0m0.740s
```
New time:
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null

real    0m9.599s
user    0m8.824s
sys     0m0.772s

```
Not that much, around -9%. But that is not the good part yet, again.

Old:
* calls to allocation functions: 3347676
* temporary allocations: 277818
* bytes allocated in total (ignoring deallocations): 10.52 GB

New:
* calls to allocation functions: 2109712 (-36%)
* temporary allocations: 33112 (-88%)
* bytes allocated in total (ignoring deallocations): 4.43 GB (-58% *sic*)

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet, MaskRay

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D54382

llvm-svn: 347198
llvm/tools/llvm-exegesis/lib/Analysis.cpp