[llvm] r300705 - [RDF] Switch NodeList to SmallVector from std::vector

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 08:12:45 PDT 2017


Author: kparzysz
Date: Wed Apr 19 10:12:44 2017
New Revision: 300705

URL: http://llvm.org/viewvc/llvm-project?rev=300705&view=rev
Log:
[RDF] Switch NodeList to SmallVector from std::vector

The list has a single element 75+% of the time, reservation of 4 elements
is sufficient in 95% of cases.

Modified:
    llvm/trunk/lib/Target/Hexagon/RDFGraph.h

Modified: llvm/trunk/lib/Target/Hexagon/RDFGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/RDFGraph.h?rev=300705&r1=300704&r2=300705&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/RDFGraph.h (original)
+++ llvm/trunk/lib/Target/Hexagon/RDFGraph.h Wed Apr 19 10:12:44 2017
@@ -508,7 +508,8 @@ namespace rdf {
   static_assert(sizeof(NodeBase) <= NodeAllocator::NodeMemSize,
         "NodeBase must be at most NodeAllocator::NodeMemSize bytes");
 
-  typedef std::vector<NodeAddr<NodeBase*>> NodeList;
+//  typedef std::vector<NodeAddr<NodeBase*>> NodeList;
+  typedef SmallVector<NodeAddr<NodeBase*>,4> NodeList;
   typedef std::set<NodeId> NodeSet;
 
   struct RefNode : public NodeBase {




More information about the llvm-commits mailing list