diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-02-02 19:04:30 +0000 | 
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-02-02 19:04:30 +0000 | 
| commit | ac18130050830f4632e8d703c97572c322a56ce2 (patch) | |
| tree | f5a191904073f0de1dbde0e201170f22ad5f49eb /clang/lib/Sema | |
| parent | 24f1d3e60a43b17bfcc612196814a137ceb6821b (diff) | |
| download | bcm5719-llvm-ac18130050830f4632e8d703c97572c322a56ce2.tar.gz bcm5719-llvm-ac18130050830f4632e8d703c97572c322a56ce2.zip  | |
Revert r124704, which uniqued code-completion strings. The space
savings of 25% sounds impressive, except that this amounted to only
about 360k in our standard "large" completion result set (40,000
results). Since code completion is performance-sensitive, the 4%
slowdown due to uniquing outweighs the 360k benefit. 
llvm-svn: 124737
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/CodeCompleteConsumer.cpp | 31 | 
1 files changed, 0 insertions, 31 deletions
diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index 572c8dcbd0e..cb2dd234b48 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp @@ -220,41 +220,10 @@ const char *CodeCompletionString::getTypedText() const {    return 0;  } -CodeCompletionAllocator::CodeCompletionAllocator() -  : llvm::BumpPtrAllocator(), StringBytesAllocated(0), StringBytesUniqued(0),  -    StringsAllocated(0), StringsUniqued(0) -{ -} - -CodeCompletionAllocator::~CodeCompletionAllocator() { } - -void CodeCompletionAllocator::PrintStats() { -  llvm::errs() << "---Code completion memory allocation---\n"  -    << "String bytes uniqued: " << StringBytesUniqued << "/" -    << StringBytesAllocated << " ("  -    << ((float)StringBytesUniqued*100/StringBytesAllocated) -    << ")\nStrings uniqued: " << StringsUniqued << "/" << StringsAllocated -    << " (" << ((float)StringsUniqued*100/StringsAllocated) -  << ")\n"; -   -  llvm::BumpPtrAllocator::PrintStats(); -} -  const char *CodeCompletionAllocator::CopyString(llvm::StringRef String) { -  llvm::DenseSet<llvm::StringRef, DenseMapStringRefInfo>::iterator Uniqued -    = UniqueStrings.find(String); -  ++StringsAllocated; -  StringBytesAllocated += String.size() + 1; -  if (Uniqued != UniqueStrings.end()) { -    StringBytesUniqued += String.size() + 1; -    ++StringsUniqued; -    return Uniqued->data(); -  } -      char *Mem = (char *)Allocate(String.size() + 1, 1);    std::copy(String.begin(), String.end(), Mem);    Mem[String.size()] = 0; -  UniqueStrings.insert(llvm::StringRef(Mem, String.size()));    return Mem;  }  | 

