PageRenderTime 343ms CodeModel.GetById 182ms app.highlight 4ms RepoModel.GetById 156ms app.codeStats 0ms

/Tools/pybench/Imports.py

http://unladen-swallow.googlecode.com/
Python | 138 lines | 105 code | 32 blank | 1 comment | 12 complexity | 57a55eeb118e50a26376177a20b1f765 MD5 | raw file
  1from pybench import Test
  2
  3# First imports:
  4import os
  5import package.submodule
  6
  7class SecondImport(Test):
  8
  9    version = 2.0
 10    operations = 5 * 5
 11    rounds = 40000
 12
 13    def test(self):
 14
 15        for i in xrange(self.rounds):
 16            import os
 17            import os
 18            import os
 19            import os
 20            import os
 21
 22            import os
 23            import os
 24            import os
 25            import os
 26            import os
 27
 28            import os
 29            import os
 30            import os
 31            import os
 32            import os
 33
 34            import os
 35            import os
 36            import os
 37            import os
 38            import os
 39
 40            import os
 41            import os
 42            import os
 43            import os
 44            import os
 45
 46    def calibrate(self):
 47
 48        for i in xrange(self.rounds):
 49            pass
 50
 51
 52class SecondPackageImport(Test):
 53
 54    version = 2.0
 55    operations = 5 * 5
 56    rounds = 40000
 57
 58    def test(self):
 59
 60        for i in xrange(self.rounds):
 61            import package
 62            import package
 63            import package
 64            import package
 65            import package
 66
 67            import package
 68            import package
 69            import package
 70            import package
 71            import package
 72
 73            import package
 74            import package
 75            import package
 76            import package
 77            import package
 78
 79            import package
 80            import package
 81            import package
 82            import package
 83            import package
 84
 85            import package
 86            import package
 87            import package
 88            import package
 89            import package
 90
 91    def calibrate(self):
 92
 93        for i in xrange(self.rounds):
 94            pass
 95
 96class SecondSubmoduleImport(Test):
 97
 98    version = 2.0
 99    operations = 5 * 5
100    rounds = 40000
101
102    def test(self):
103
104        for i in xrange(self.rounds):
105            import package.submodule
106            import package.submodule
107            import package.submodule
108            import package.submodule
109            import package.submodule
110
111            import package.submodule
112            import package.submodule
113            import package.submodule
114            import package.submodule
115            import package.submodule
116
117            import package.submodule
118            import package.submodule
119            import package.submodule
120            import package.submodule
121            import package.submodule
122
123            import package.submodule
124            import package.submodule
125            import package.submodule
126            import package.submodule
127            import package.submodule
128
129            import package.submodule
130            import package.submodule
131            import package.submodule
132            import package.submodule
133            import package.submodule
134
135    def calibrate(self):
136
137        for i in xrange(self.rounds):
138            pass