Attempts at speeding up bitcode reading

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Nov 17 09:28:39 PST 2014


I have spent some time trying to speed up the reading of bitcode
files. Some of the changes went in (reading 64 bits at a time), but it
seems hard to make other small incremental improvements.

I was benchmarking just the reading of the combined bitcode file of a
clang lto build with "opt -disable-output -disable-verify". The
attached patch is what I had so far. It does speed it up a bit, from
7.13s to 6.86s, but would need a bit of work to make it commit
quality. In particular, the patch just disables lazy streaming to see
what the impact would be.

With the patch applied the readRecord function is still the function
taking the largest chunk of time, but there is no obvious hot spot in
it.

A possibility I don't think I have the time to check is that the cost
is simply spread out over reading data into an array of uint64_t and
then having the caller interpret that.

If that assumption is correct, a possible improvement would be to replace

Code = readeRecord(Vals);

with

Code, NumElems = readRecordHead();
...
  readRecordElem(); // returns one of the uint64_t elements.

I am sending the patch in case someone else wants to dig into it a bit more.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: text/x-patch
Size: 40719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141117/cf1e09d3/attachment.bin>


More information about the llvm-commits mailing list