Show
Ignore:
Timestamp:
06/10/09 16:32:58 (3 years ago)
Author:
amix
Message:

Improved perfomance of delete and the benchmark program

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lightcloud/lightcloud/test/benchmark.py

    r22 r24  
    2727def generic_bench(name, times_run, fn): 
    2828    start = time() 
    29     print 'Running "%s" %s times...' % (name, times_run) 
    3029    for i in range(0, times_run): 
    3130        fn() 
    32     print 'Finished "%s" in %s' % (name, time()-start) 
    33     print '------' 
     31    end = time()-start 
     32    pr_sec = float(times_run)/end 
     33    print 'Finished "%s" %s times in %0.2f sec [%0.1f operations pr.sec]' %\ 
     34            (name, times_run, end, pr_sec) 
    3435 
    3536 
     
    4041              lambda: lightcloud.set('hello', 'world', system='redis')) 
    4142 
     43print '------' 
     44 
    4245generic_bench('Tyrant get', 10000, 
    4346              lambda: lightcloud.get('hello', system='tyrant')) 
    4447generic_bench('Redis get', 10000, 
    4548              lambda: lightcloud.get('hello', system='redis')) 
     49 
     50print '------' 
    4651 
    4752generic_bench('Tyrant list_add', 10000, 
     
    5055              lambda: lightcloud.list_add('hello_l', ['1'], system='redis')) 
    5156 
     57print '------' 
     58 
    5259generic_bench('Tyrant delete', 10000, 
    5360              lambda: lightcloud.delete('hello', system='tyrant'))