diff options
| author | Reid Kleckner <rnk@google.com> | 2017-07-13 22:02:23 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2017-07-13 22:02:23 +0000 |
| commit | 05c70f5dbad16421a0909ff10452b63d7c2da5f1 (patch) | |
| tree | 19bca3bf1a5ed73240010cbe5f74b01215a27ed4 /llvm/lib/CodeGen/MachinePostDominators.cpp | |
| parent | c56d444b75b1d45c96df61162e5604a11f4ca0f0 (diff) | |
| download | bcm5719-llvm-05c70f5dbad16421a0909ff10452b63d7c2da5f1.tar.gz bcm5719-llvm-05c70f5dbad16421a0909ff10452b63d7c2da5f1.zip | |
[PDB] Fix quadratic behavior when writing a BinaryItemStream
Binary streams are an abstraction over a discontiguous buffer. To write
a discontiguous buffer, we want to copy each contiguous chunk
individually. Currently BinaryStreams do not expose a way to iterate
over the chunks, so the code repeatedly calls
readLongestContiguousChunk() with an increasing offset. In order to
lookup the chunk by offset, we would iterate the items list to figure
out which chunk the offset is within. This is obviously O(n^2).
Instead, pre-compute a table of offsets and do a binary search to figure
out which chunk to use. This is still only an O(n^2) to O(n log n)
improvement, but it's a very local fix that seems worth doing.
This improves self-linking lld.exe with PDBs from 90s to 10s.
llvm-svn: 307970
Diffstat (limited to 'llvm/lib/CodeGen/MachinePostDominators.cpp')
0 files changed, 0 insertions, 0 deletions

