speed up -emit-html in a release build by 6.5% by avoiding std::string.
llvm-svn: 49764
This commit is contained in:
parent
e556f9e39c
commit
e4dd37ce0a
|
@ -56,8 +56,10 @@ HTMLPrinter::~HTMLPrinter() {
|
|||
// Emit the HTML.
|
||||
|
||||
if (const RewriteBuffer *RewriteBuf = R.getRewriteBufferFor(FileID)) {
|
||||
std::string S(RewriteBuf->begin(), RewriteBuf->end());
|
||||
printf("%s\n", S.c_str());
|
||||
char *Buffer = (char*)malloc(RewriteBuf->size());
|
||||
std::copy(RewriteBuf->begin(), RewriteBuf->end(), Buffer);
|
||||
fwrite(Buffer, 1, RewriteBuf->size(), stdout);
|
||||
free(Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
typedef BufferTy::const_iterator iterator;
|
||||
iterator begin() const { return Buffer.begin(); }
|
||||
iterator end() const { return Buffer.end(); }
|
||||
unsigned size() const { return Buffer.size(); }
|
||||
|
||||
private: // Methods only usable by Rewriter.
|
||||
|
||||
|
|
Loading…
Reference in New Issue