Sha256: 7b1e7a9a246003f94d7e8146ad01862bf2a89970d2c0f26f2d448b2994e60160

Contents?: true

Size: 518 Bytes

Versions: 30

Compression:

Stored size: 518 Bytes

Contents

import re
import time

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

def timefunc(n, func, *args, **kw):
    t0 = time.clock()
    try:
        for i in range(n):
            result = apply(func, args, kw)
        return result
    finally:
        t1 = time.clock()
        if n > 1:
            print n, "times",
        print func.__name__, "%.3f" % (t1-t0), "CPU seconds"

main()

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.19.2.0 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.17.3.2 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.17.3.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.17.3.0 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.16.3.2 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.16.3.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.16.0.4 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.16.0.3 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.16.0.2 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.16.0.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.16.0.0 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.13.7.3 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.13.6.2 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.13.6.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.13.5.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.13.4.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.13.3.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.12.5.1 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.12.5.0 lib/rubyfox/server/data/lib/Lib/test/reperf.py
rubyfox-server-2.12.4.0 lib/rubyfox/server/data/lib/Lib/test/reperf.py