Changeset 24 for lightcloud/lightcloud/test/benchmark.py
- Timestamp:
- 06/10/09 16:32:58 (3 years ago)
- Files:
-
- lightcloud/lightcloud/test/benchmark.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lightcloud/lightcloud/test/benchmark.py
r22 r24 27 27 def generic_bench(name, times_run, fn): 28 28 start = time() 29 print 'Running "%s" %s times...' % (name, times_run)30 29 for i in range(0, times_run): 31 30 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) 34 35 35 36 … … 40 41 lambda: lightcloud.set('hello', 'world', system='redis')) 41 42 43 print '------' 44 42 45 generic_bench('Tyrant get', 10000, 43 46 lambda: lightcloud.get('hello', system='tyrant')) 44 47 generic_bench('Redis get', 10000, 45 48 lambda: lightcloud.get('hello', system='redis')) 49 50 print '------' 46 51 47 52 generic_bench('Tyrant list_add', 10000, … … 50 55 lambda: lightcloud.list_add('hello_l', ['1'], system='redis')) 51 56 57 print '------' 58 52 59 generic_bench('Tyrant delete', 10000, 53 60 lambda: lightcloud.delete('hello', system='tyrant'))
