From bad09e71d063aef62deca30e90a33cb3fd25bdb5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 3 Oct 2005 21:26:53 +0000 Subject: Use a map to cache the ModuleType information, so we can do logarithmic lookups instead of linear time lookups. This speeds up bc parsing of a large file from 137.834u 118.256s 4:27.96 to 132.611u 114.436s 4:08.53 with a release build. llvm-svn: 23611 --- llvm/lib/Bytecode/Reader/Reader.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Bytecode/Reader/Reader.h') diff --git a/llvm/lib/Bytecode/Reader/Reader.h b/llvm/lib/Bytecode/Reader/Reader.h index eec5de98493..df0ddca7472 100644 --- a/llvm/lib/Bytecode/Reader/Reader.h +++ b/llvm/lib/Bytecode/Reader/Reader.h @@ -333,6 +333,12 @@ private: /// @brief This vector is used to deal with forward references to types in /// a module. TypeListTy ModuleTypes; + + /// @brief This is an inverse mapping of ModuleTypes from the type to an + /// index. Because refining types causes the index of this map to be + /// invalidated, any time we refine a type, we clear this cache and recompute + /// it next time we need it. These entries are ordered by the pointer value. + std::vector > ModuleTypeIDCache; /// @brief This vector is used to deal with forward references to types in /// a function. -- cgit v1.2.3