diff options
author | Anthon van der Neut <anthon@mnt.org> | 2013-08-06 15:33:27 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2013-08-06 15:33:27 +0200 |
commit | 719e89fc1a2b74878c6907032377ce516e10778f (patch) | |
tree | 828655cca58d9ca4b400f825550a4476d1965273 /bench | |
parent | 7d86827b5edfaeaff8d6bcf968ffaae5534e806a (diff) | |
download | pytest-719e89fc1a2b74878c6907032377ce516e10778f.tar.gz |
argcomplete: FastFileCompleter that doesn't call bash in subprocess, strip prefix dir
```
timeit result for 10000 iterations of expanding '/d' (lowered the count in the code afterwards)
# 2.7.5 3.3.2
# FilesCompleter 75.1109 69.2116
# FastFilesCompleter 0.7383 1.0760
```
- does not display prefix dir (like bash, not like compgen), py.test /usr/<TAB> does not show /usr/bin/ but bin/
Diffstat (limited to 'bench')
-rw-r--r-- | bench/bench_argcomplete.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bench/bench_argcomplete.py b/bench/bench_argcomplete.py new file mode 100644 index 000000000..d66c664f3 --- /dev/null +++ b/bench/bench_argcomplete.py @@ -0,0 +1,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))) |