From 6301eb8919cf0d4fb3b96aba1bb8d9f984282df5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 10 Feb 2007 07:31:44 +0000 Subject: [PATCH] Make BytecodeWriter::outputValueSymbolTable *significantly* less abusive of memory, through a combination of DenseMap and SmallVector. This speeds up bcwriter on 447.dealII from 1.31s to 0.82s (60% faster). llvm-svn: 34141 --- lib/Bytecode/Writer/Writer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index bdd3ca44300..df62bf934ba 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -33,6 +33,7 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/Streams.h" #include "llvm/System/Program.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Statistic.h" #include @@ -1087,15 +1088,15 @@ void BytecodeWriter::outputValueSymbolTable(const ValueSymbolTable &VST) { // Organize the symbol table by type typedef std::pair PlaneMapEntry; - typedef std::vector PlaneMapVector; - typedef std::map PlaneMap; + typedef SmallVector PlaneMapVector; + typedef DenseMap PlaneMap; PlaneMap Planes; for (ValueSymbolTable::const_iterator SI = VST.begin(), SE = VST.end(); SI != SE; ++SI) Planes[SI->second->getType()] .push_back(std::make_pair(&SI->first, SI->second)); - for (PlaneMap::const_iterator PI = Planes.begin(), PE = Planes.end(); + for (PlaneMap::iterator PI = Planes.begin(), PE = Planes.end(); PI != PE; ++PI) { PlaneMapVector::const_iterator I = PI->second.begin(); PlaneMapVector::const_iterator End = PI->second.end();