This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Avoid reallocating buffers for each message read:
ClosedPublic

Authored by sammccall on Dec 21 2020, 11:13 AM.

Details

Summary
  • reuse std::string we read messages into
  • when reading line-wise, use SmallVector<128> and read in chunks of 128 (this affects headers, which are short, and tests, which don't matter)

Diff Detail

Event Timeline

sammccall created this revision.Dec 21 2020, 11:13 AM
sammccall requested review of this revision.Dec 21 2020, 11:13 AM
njames93 accepted this revision.Dec 28 2020, 12:07 PM

I'm easy with this.

clang-tools-extra/clangd/JSONTransport.cpp
202

nit:

This revision is now accepted and ready to land.Dec 28 2020, 12:07 PM