def test_dumps(self): n = 10000 print "" for name in names: cpg_time = timefunc(cpghstore.dumps, n, name) if pghstore: pg_time = timefunc(pghstore.dumps, n, name) self.assertTrue(cpg_time < pg_time) print ".. n=%i, dictlen=%i, cpghstore.dumps (%.2fs) is %ix faster than pghstore.dumps (%.2fs)" % ( n, len(name), cpg_time, floor(pg_time / cpg_time), pg_time) else: print ".. n=%i, dictlen=%i, cpghstore.dumps done in %.2fs" % ( n, len(name), cpg_time)
def test_loads(self): n = 10000 print("") for name in names: cpg_time = timefunc(cpghstore.loads, n, name) if pghstore: pg_time = timefunc(pghstore.loads, n, name) self.assertTrue(cpg_time < pg_time) print( ".. n=%i, strlen=%i, cpghstore.loads (%.2fs) is %ix faster than pghstore.loads (%.2fs)" % (n, len(name), cpg_time, floor(pg_time / cpg_time), pg_time) ) else: print(".. n=%i, strlen=%i, cpghstore.loads done in %.2fs" % (n, len(name), cpg_time))