s
= "\13hello\14 \13world\14 " * 1000
p
= re
.compile(r
"([\13\14])")
timefunc(10, p
.sub
, "", s
)
timefunc(10, p
.findall
, s
)
def timefunc(n
, func
, *args
, **kw
):
result
= func(*args
, **kw
)
print func
.__name
__, "%.3f" % (t1
-t0
), "CPU seconds"