summaryrefslogtreecommitdiff
path: root/bench/bench_argcomplete.py
blob: d66c664f346efdc6281f1b27109ddcac09232372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19


# 10000 iterations, just for relative comparison
#                      2.7.5     3.3.2
# FilesCompleter       75.1109   69.2116
# FastFilesCompleter    0.7383    1.0760


if __name__ == '__main__':
    import sys
    import timeit
    from argcomplete.completers import FilesCompleter
    from _pytest._argcomplete import FastFilesCompleter
    count = 1000 # only a few seconds
    setup = 'from __main__ import FastFilesCompleter\nfc = FastFilesCompleter()'
    run = 'fc("/d")'
    sys.stdout.write('%s\n' % (timeit.timeit(run,
                                setup=setup.replace('Fast', ''), number=count)))
    sys.stdout.write('%s\n' % (timeit.timeit(run, setup=setup, number=count)))