speed up -emit-html in a release build by 6.5% by avoiding std::string.

llvm-svn: 49764
This commit is contained in:
Chris Lattner 2008-04-16 03:46:57 +00:00
parent e556f9e39c
commit e4dd37ce0a
2 changed files with 5 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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.