def rb_build(): tree = RBTree.from_keys(keys)
from __main__ import rb_build_delete, rb_build, rb_search """ setup_FastRBTree = """ from __main__ import crb_build_delete, crb_build, crb_search """ try: fp = open('testkeys.txt') keys = eval(fp.read()) fp.close() bskeys = zip(keys, keys) except IOError: print("create 'testkeys.txt' with profile_bintree.py\n") sys.exit() py_searchtree = RBTree.from_keys(keys) cy_searchtree = FastRBTree.from_keys(keys) def rb_build_delete(): tree = RBTree.from_keys(keys) for key in keys: del tree[key] def crb_build_delete(): tree = FastRBTree.from_keys(keys) for key in keys: del tree[key]
def rb_build_delete(): tree = RBTree.from_keys(keys) for key in keys: del tree[key]
from __main__ import keys, rb_prev, rb_succ """ setup_FastRBTree_ps = """ from __main__ import keys, crb_prev, crb_succ """ try: fp = open('testkeys.txt') keys = eval(fp.read()) fp.close() bskeys = zip(keys, keys) except IOError: print("create 'testkeys.txt' with profile_bintree.py\n") sys.exit() ptree = PTree.from_keys(keys) ftree = FTree.from_keys(keys) def rb_prev(): for key in keys: try: item = ptree.prev_item(key) except KeyError: pass def rb_succ(): for key in keys: try: item = ptree.succ_item(key)