<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82861>82861</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Improve llvm-dwp performance
</td>
</tr>
<tr>
<th>Labels</th>
<td>
tools:llvm-dwp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
petrhosek
</td>
</tr>
</table>
<pre>
llvm-dwp memory usage (and probably runtime) isn't great compared to binutils dwp. Problem is the that the existing object reading/writing abstractions aren't a great fit.
llvm-dwp uses `MCObjectStreamer` which buffers the whole file on a per-section basis. When the input files aren't compressed, we should be able to just keep track of which part of the input files we're going to write to the output file and then directly copy from input to output, never buffering.
`MCObjectStreamer` was introduced circa 2010, back when LLVM emitted assembly and relied on an external assembler. The `MCObjectStreamer` design made it easy to support assembly output and (direct object emission) object file output, but it doesn't work at a lower layer... `MCObjectStreamer` also has abstraction overhead for fixups, relaxation, etc. and the design is difficult to change to support streaming output as a secondary goal without hurting the current primary use case (generating a relocatable object file). It'd be great for LLVM to have a lower-level object writing API—usable under `MCObjectStreamer`, and maybe even LLD, ORC JIT, etc.
Alternative would be to use `DWARFLinker` which has a whole different set of tradeoffs. It could still stream output though since it's designed to work in a single pass.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0Vc1u4zgMfhrlQtRwlbRxDjl02w3QRQczmB3snGWLtjWVJYOkkubtF1KcTneBHvLnyOT3R9owuyEg7tXdH-ruaWWSjJH2MwqNkfF11UZ73nt_nG7saYYJp0hnSGwGBKUbEyzMFFvT-jNQCuImVHoHjoPSW4GB0Ah0cZoNoQWJ0LqQxHkGe5or-Eax9TiBY5ARQUYj5Qu-ORYXBojtL-wECI11YVD6cCJX_jAtC5lOXAwMhvDSzywdeyeVqp9U_XB5fyeQGBnUff3l8Wup_LcQmglJ3ddwGl03Qpv6HumC5zRGj9A7jxADGJiRbhhLU2gNO67g54ihnHVhTl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