def main(argv): # Initialize new external memory list. util.msg('Populating normal and external memory list') t1 = time.time() dirname = util.make_temp_name('em_list') l = [] em_list = pyrsistence.EMList(dirname) for i in util.xrange(0x1000000): v = random.randrange(0x1000000) em_list.append(v) l.append(v) t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) util.msg('Verifying external memory list contents') for i in util.xrange(0x1000000): if em_list[i] != l[i]: util.msg('FATAL! Mismatch in element %d: Got %#x but expected %#x' % (i, em_list[i], l[i])) t3 = time.time() util.msg('Done in %d sec.' % (t3 - t2)) # Close and remove external memory list from disk. em_list.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory list. util.msg('Populating external memory list') t1 = time.time() dirname = util.make_temp_name('em_list') em_list = pyrsistence.EMList(dirname) for i in util.xrange(0x1000): em_list.append(random.randrange(0x100000)) t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) # Request several iterator objects to locate possible memory leaks. util.msg('Testing iterator') for i in util.xrange(0x1000): for item in em_list: pass t3 = time.time() util.msg('Done in %d sec.' % (t3 - t2)) # Close and remove external memory list from disk. em_list.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory list. util.msg('Populating normal and external memory list') t1 = time.time() dirname = util.make_temp_name('em_list') l = [] em_list = pyrsistence.EMList(dirname) for i in util.xrange(0x1000000): v = random.randrange(0x1000000) em_list.append(v) l.append(v) t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) util.msg('Verifying external memory list contents') for i in util.xrange(0x1000000): if em_list[i] != l[i]: util.msg( 'FATAL! Mismatch in element %d: Got %#x but expected %#x' % (i, em_list[i], l[i])) t3 = time.time() util.msg('Done in %d sec.' % (t3 - t2)) # Close and remove external memory list from disk. em_list.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory dictionary. util.msg('Populating normal and external memory dictionary') t1 = time.time() dirname = util.make_temp_name('em_dict') d = {} em_dict = pyrsistence.EMDict(dirname) for i in util.xrange(0x1000000): v = random.randrange(0x1000000) em_dict[i] = v d[i] = v t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) util.msg('Verifying external memory dictionary contents') for i in util.xrange(0x1000000): if em_dict[i] != d[i]: util.msg( 'FATAL! Mismatch in element %d: Got %#x but expected %#x' % (i, em_dict[i], d[i])) t3 = time.time() util.msg('Done in %d sec.' % (t3 - t2)) # Close and remove external memory dictionary from disk. em_dict.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory list. util.msg('Populating external memory list') t1 = time.time() dirname = util.make_temp_name('em_list') em_list = pyrsistence.EMList(dirname) for i in xrange(0x1000): em_list.append(random.randrange(0x100000)) t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) # Request several iterator objects to locate possible memory leaks. util.msg('Testing iterator') for i in xrange(0x1000): for item in em_list: pass t3 = time.time() util.msg('Done in %d sec.' % (t3 - t2)) # Close and remove external memory list from disk. em_list.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory dictionary. util.msg('Populating normal and external memory dictionary') t1 = time.time() dirname = util.make_temp_name('em_dict') d = {} em_dict = pyrsistence.EMDict(dirname) for i in util.xrange(0x1000000): v = random.randrange(0x1000000) em_dict[i] = v d[i] = v t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) util.msg('Verifying external memory dictionary contents') for i in util.xrange(0x1000000): if em_dict[i] != d[i]: util.msg('FATAL! Mismatch in element %d: Got %#x but expected %#x' % (i, em_dict[i], d[i])) t3 = time.time() util.msg('Done in %d sec.' % (t3 - t2)) # Close and remove external memory dictionary from disk. em_dict.close() shutil.rmtree(dirname) return 0
def main(): # Initialize new external memory dictionary. util.msg('Populating external memory dictionary') t1 = time.time() dirname = util.make_temp_name('em_dict') em_dict = pyrsistence.EMDict(dirname) for i in util.xrange(random.randrange(0x1000)): k = random.randrange(0x100000) v = random.randrange(0x100000) em_dict[k] = v t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) # Request several iterator objects to locate possible memory leaks. util.msg('Testing item iterator') for i in util.xrange(0x1000): for item in em_dict.items(): pass util.msg('Testing keys iterator') for i in util.xrange(0x1000): for key in em_dict.keys(): pass util.msg('Testing values iterator') for i in util.xrange(0x1000): for value in em_dict.values(): pass t3 = time.time() util.msg('Done in %d sec.' % (t3 - t2)) # Close and remove external memory dictionary from disk. em_dict.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory dictionary. util.msg('Populating external memory dictionary') t1 = time.time() dirname = util.make_temp_name('em_dict') em_dict = pyrsistence.EMDict(dirname) for i in util.xrange(0x1000000): em_dict[i] = i t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) # Close and remove external memory dictionary from disk. em_dict.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory list. util.msg('Populating external memory list') t1 = time.time() dirname = util.make_temp_name('em_list') em_list = pyrsistence.EMList(dirname) for i in xrange(0x1000000): em_list.append(i) t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) # Close and remove external memory list from disk. em_list.close() shutil.rmtree(dirname) return 0
def main(argv): # Initialize new external memory list. util.msg('Populating external memory list') t1 = time.time() dirname = util.make_temp_name('em_list') em_list = pyrsistence.EMList(dirname) for i in util.xrange(0x1000000): em_list.append(i) t2 = time.time() util.msg('Done in %d sec.' % (t2 - t1)) # Close and remove external memory list from disk. em_list.close() shutil.rmtree(dirname) return 0