pbrady/fastcache

benchmark.run() crashes

Closed this issue · 4 comments

[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from fastcache import benchmark
>>> benchmark.run()
Test Suite 1 :

Primarily tests cost of function call, hashing and cache hits.
Benchmark script based on
    http://bugs.python.org/file28400/lru_cache_bench.py

function call                 speed up
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/barak/.local/share/virtualenvs/localstack-wqSy0wE1/lib/python3.7/site-packages/fastcache/benchmark.py", line 79, in run
    repeat=10, number=1000))
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/timeit.py", line 237, in repeat
    return Timer(stmt, setup, timer, globals).repeat(repeat, number)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/timeit.py", line 121, in __init__
    compile(stmtprefix + stmt, dummy_src_name, "exec")
  File "<timeit-src>", line 3
    for i in range(100):
    ^
IndentationError: unexpected indent

modify benchmark.py

line 94: t = min(timeit.repeat('''for i, j in _arg_gen():\n %s''' % s, setup=setup.format(f),
line 74: t = min(timeit.repeat('''for i in range(100):\n {}'''.format(s),

It looks like the author didn't merge #50

#55

I think it can be directly used functools.lru_cache in python35 and latter

closed by #50