MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testLookupScaling

Method testLookupScaling

test/IECore/PathMatcherTest.py:93–127  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

91 self.assertEqual( m.match( path ), result )
92
93 def testLookupScaling( self ) :
94
95 # this test provides a useful means of measuring performance when
96 # working on the PatchMatcher algorithm. it tests matchers
97 # for each of two different hierarchies :
98 #
99 # * a deep hierarchy with relatively few children at each branch point
100 # * a shallow hierarchy with large numbers of children at each branch point
101 #
102 # the tests build a matcher, and then assert that every path in the hierarchy is
103 # matched appropriately. uncomment the timers to get useful information printed out.
104
105 match = IECore.PathMatcher.Result.ExactMatch
106
107 # deep hierarchy
108 paths = self.generatePaths( seed = 10, depthRange = ( 3, 14 ), numChildrenRange = ( 2, 6 ) )
109 t = IECore.Timer()
110 matcher = IECore.PathMatcher( paths )
111 #print "BUILD DEEP", t.stop()
112
113 t = IECore.Timer()
114 for path in paths :
115 self.assertTrue( matcher.match( path ) & match )
116 #print "LOOKUP DEEP", t.stop()
117
118 # shallow hierarchy
119 paths = self.generatePaths( seed = 10, depthRange = ( 2, 2 ), numChildrenRange = ( 500, 1000 ) )
120 t = IECore.Timer()
121 matcher = IECore.PathMatcher( paths )
122 #print "BUILD SHALLOW", t.stop()
123
124 t = IECore.Timer()
125 for path in paths :
126 self.assertTrue( matcher.match( path ) & match )
127 #print "LOOKUP SHALLOW", t.stop()
128
129 def testDefaultConstructor( self ) :
130

Callers

nothing calls this directly

Calls 4

generatePathsMethod · 0.95
matchMethod · 0.95
TimerMethod · 0.80
PathMatcherMethod · 0.80

Tested by

no test coverage detected