summaryrefslogtreecommitdiffstats
path: root/lib/Sema/CodeCompleteConsumer.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-02 19:04:30 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-02 19:04:30 +0000
commit6159d0fe2d40708b5a3caab91c8292253894ebf3 (patch)
treee5ab1e2b0e2ba5d8cf6fa97541d9d74115e70abe /lib/Sema/CodeCompleteConsumer.cpp
parent8e50a96b387dca7525caa8a6add31420dd82a2cd (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r--lib/Sema/CodeCompleteConsumer.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp
index 572c8dcbd0..cb2dd234b4 100644
--- a/lib/Sema/CodeCompleteConsumer.cpp
+++ b/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;
}