Skip to content

Commit

Permalink
Merge pull request #3 from larsmans/master
Browse files Browse the repository at this point in the history
simple benchmark script
  • Loading branch information
larsmans committed Apr 28, 2016
2 parents a630805 + 1413e8e commit 0153ef0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions benchmark.py
@@ -0,0 +1,16 @@
import sys
from timeit import timeit

from leven import levenshtein

n_runs = 30

with open("/usr/share/dict/words") as f:
strs = [ln.strip() for ln in f]
print("Running %d times on %d reference strings" % (n_runs, len(strs)))

arg = sys.argv[1]
t = timeit(stmt='for s in strs: levenshtein(arg, s)',
setup='from __main__ import arg, levenshtein, strs',
number=n_runs)
print("%.3f seconds" % t)

0 comments on commit 0153ef0

Please sign in to comment.