Back to index

python3.2  3.2.2
Functions
test.reperf Namespace Reference

Functions

def main
def timefunc

Function Documentation

Definition at line 4 of file reperf.py.

00004 
00005 def main():
00006     s = "\13hello\14 \13world\14 " * 1000
00007     p = re.compile(r"([\13\14])")
00008     timefunc(10, p.sub, "", s)
00009     timefunc(10, p.split, s)
00010     timefunc(10, p.findall, s)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.reperf.timefunc (   n,
  func,
  args,
  kw 
)

Definition at line 11 of file reperf.py.

00011 
00012 def timefunc(n, func, *args, **kw):
00013     t0 = time.clock()
00014     try:
00015         for i in range(n):
00016             result = func(*args, **kw)
00017         return result
00018     finally:
00019         t1 = time.clock()
00020         if n > 1:
00021             print(n, "times", end=' ')
00022         print(func.__name__, "%.3f" % (t1-t0), "CPU seconds")
00023 
00024 main()

Here is the call graph for this function:

Here is the caller graph for this function: