This is an archive of the discontinued LLVM Phabricator instance.

Don't keep re-allocating the temp serializer.
ClosedPublic

Authored by zturner on May 24 2017, 10:03 AM.

Details

Summary

Previously, every time we wanted to serialize a field list record, we would create a new copy of FieldListRecordBuilder, which would in turn create a temporary instance of TypeSerializer, which itself had a std::vector<> that was about 128K in size. So this 128K allocation was happening every time. We can re-use the same instance over and over, we just have to clear its internal hash table and seen records list between each run. This saves us from the constant re-allocations.

This is worth an ~18.5% speed increase (3.75s -> 3.05s) in my tests.

Diff Detail

Event Timeline

zturner created this revision.May 24 2017, 10:03 AM
rnk accepted this revision.May 24 2017, 11:22 AM

lgtm

This revision is now accepted and ready to land.May 24 2017, 11:22 AM
This revision was automatically updated to reflect the committed changes.