[PATCH] D36940: Replace std::vector to std::array in SymbolSerializer
Zachary Turner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 21 13:19:26 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL311375: [PDB] Serialize records into a stack-allocated buffer. (authored by zturner).
Changed prior to commit:
https://reviews.llvm.org/D36940?vs=111903&id=112047#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36940
Files:
llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
llvm/trunk/lib/DebugInfo/CodeView/SymbolSerializer.cpp
Index: llvm/trunk/lib/DebugInfo/CodeView/SymbolSerializer.cpp
===================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/SymbolSerializer.cpp
+++ llvm/trunk/lib/DebugInfo/CodeView/SymbolSerializer.cpp
@@ -21,8 +21,7 @@
SymbolSerializer::SymbolSerializer(BumpPtrAllocator &Allocator,
CodeViewContainer Container)
- : Storage(Allocator), RecordBuffer(MaxRecordLength),
- Stream(RecordBuffer, support::little), Writer(Stream),
+ : Storage(Allocator), Stream(RecordBuffer, support::little), Writer(Stream),
Mapping(Writer, Container) {}
Error SymbolSerializer::visitSymbolBegin(CVSymbol &Record) {
Index: llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
===================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
@@ -28,7 +28,10 @@
class SymbolSerializer : public SymbolVisitorCallbacks {
BumpPtrAllocator &Storage;
- std::vector<uint8_t> RecordBuffer;
+ // Since this is a fixed size buffer, use a stack allocated buffer. This
+ // yields measurable performance increase over the repeated heap allocations
+ // when serializing many independent records via writeOneSymbol.
+ std::array<uint8_t, MaxRecordLength> RecordBuffer;
MutableBinaryByteStream Stream;
BinaryStreamWriter Writer;
SymbolRecordMapping Mapping;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36940.112047.patch
Type: text/x-patch
Size: 1493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170821/f6492644/attachment.bin>
More information about the llvm-commits
mailing list