Skip to content

Instantly share code, notes, and snippets.

@cjsmeele
Created December 11, 2019 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjsmeele/1f2b72b6584caf569c8ca208ed964e61 to your computer and use it in GitHub Desktop.
Save cjsmeele/1f2b72b6584caf569c8ca208ed964e61 to your computer and use it in GitHub Desktop.
# Include in core.py, and run as: `irule test null null`
# Results end up in rodsLog.
#
# My results with 9052 collections and 10 tests for each genquery version:
#
# original row_iterator: avg: 739ms, max: 821ms, min: 715ms
# extended row_iterator: avg: 376ms, max: 388ms, min: 367ms
import time
import genquery
def f(callback):
x = time.time()
print(len(list(genquery.row_iterator('COLL_NAME', '', genquery.AS_LIST, callback))))
y = time.time()
return int((y-x)*1000)
def test(rule_args, callback, rei):
ts = []
for i in range(10):
x = f(callback)
ts += [x]
print('time: %4dms' % x)
print('avg: %4dms, max: %4dms, min: %4dms' % (sum(ts)/len(ts), max(ts), min(ts)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment