mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[byteTree] Write fixed sized data using an optimized form
If we know the size of a type at compile time (like we do for all the integer types), it is cheaper to assign the data buffer directly instead of using a memcpy.
This commit is contained in:
@@ -729,14 +729,15 @@ int doSerializeRawTree(const char *MainExecutablePath,
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
llvm::AppendingBinaryByteStream Stream(llvm::support::endianness::little);
|
||||
llvm::BinaryStreamWriter Writer(Stream);
|
||||
swift::ExponentialGrowthAppendingBinaryByteStream Stream(
|
||||
llvm::support::endianness::little);
|
||||
Stream.reserve(32 * 1024);
|
||||
std::map<void *, void *> UserInfo;
|
||||
UserInfo[swift::byteTree::UserInfoKeyReusedNodeIds] = &ReusedNodeIds;
|
||||
if (options::AddByteTreeFields) {
|
||||
UserInfo[swift::byteTree::UserInfoKeyAddInvalidFields] = (void *)true;
|
||||
}
|
||||
swift::byteTree::ByteTreeWriter::write(/*ProtocolVersion=*/1, Writer,
|
||||
swift::byteTree::ByteTreeWriter::write(Stream, /*ProtocolVersion=*/1,
|
||||
*Root, UserInfo);
|
||||
auto OutputBufferOrError = llvm::FileOutputBuffer::create(
|
||||
options::OutputFilename, Stream.data().size());
|
||||
|
||||
Reference in New Issue
Block a user