[NFC][Exegesis] Don't recompute opcode/reg names on each YAML write (-38% runtime)
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 12 Dec 2022 21:02:05 +0000 (00:02 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 12 Dec 2022 22:03:38 +0000 (01:03 +0300)
commit079cd4a52f398ccf4a04cf47f2c3c536a5011585
treea4c89225adf79aa20abf051daaf4059ba3e05c80
parent79909c031d43de21ce9c10394a5aac08bec0a874
[NFC][Exegesis] Don't recompute opcode/reg names on each YAML write (-38% runtime)

This reducer runtime of
```
$ ./bin/llvm-exegesis -mode=inverse_throughput --opcode-index=-1 --benchmarks-file=/dev/null --dump-object-to-disk=0 --measurements-print-progress --skip-measurements
```
from 3m44s to 2m17s, aka -38%.
But more importantly, we go from 400 *million* memory allocations
down to just 100 million, aka -75%.

But really, the big missing thing is doing everything in a single thread.
Sure, we can't do anything when measuring, but when we are not measuring,
we should just prepare (codegen) everything via all threads.
That should parallelize quite well.
llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
llvm/tools/llvm-exegesis/lib/LlvmState.cpp
llvm/tools/llvm-exegesis/lib/LlvmState.h