-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SourceKit] Avoid one memcpy on potentially big sourcekit response data #30929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SourceKit] Avoid one memcpy on potentially big sourcekit response data #30929
Conversation
@swift-ci Please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Build failed |
69478e1
to
8a5b4ff
Compare
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please test Linux |
|
||
char *start = result->getBufferStart(); | ||
char *start = result->getBufferStart() + sizeof(uint64_t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: + kindSize
BufferPtr(llvm::MemoryBuffer::getMemBufferCopy( | ||
MemBuf->getBuffer(), | ||
MemBuf->getBufferIdentifier())) | ||
SKDCustomData(std::unique_ptr<llvm::MemoryBuffer>& MemBuf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are changing this from copying the buffer to taking ownership of it, so the type should be rvalue reference (&&
) or else by value, not by lvalue reference.
A kind indicator is needed before the actual data when custom data are storeed as xpc dictionary values. Instead of prepending the kind bit by copying data to another buffer, let the data producers include it in the created data.
8a5b4ff
to
69971af
Compare
@swift-ci Please smoke test |
@swift-ci Please smoke test windows |
A kind indicator is needed before the actual data when custom data are stored as xpc dictionary values. Instead of prepending the kind bit by copying data to another buffer, let the data producers include it in the created data.