def __init__(self, parent, log):
        #visibleRows = None
        gridlib.Grid.__init__(self, parent, -1)

        memb = mem_profile.memory_usage_psutil()
        print('Memory (Before): {}Mb'.format(memb))
        t1 = time.clock()
        self.tableBase = HugeTable(log)
        t2 = time.clock()

        # The second parameter means that the grid is to take ownership of the
        # table and will destroy it when done.  Otherwise you would need to keep
        # a reference to it and call it's Destroy method later.
        self.SetTable(self.tableBase, True)

        memf = mem_profile.memory_usage_psutil()
        print('Memory (After) : {}Mb'.format(memf))
        print('Diff {} mem'.format(memf - memb))
        print('Diff {} mem'.format(1024 * (memf - memb)))
        print('Took {} Seconds'.format(t2 - t1))

        self.Bind(gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightDown)
Exemplo n.º 2
0
import mem_profile
import random
import time

names = ['John', 'Corey', 'Adam', 'Steve', 'Rick', 'Thomas']
majors = ['Math', 'Engineering', 'CompSci', 'Arts', 'Business']

print('Memory (Before): {}Mb'.format(mem_profile.memory_usage_psutil()))

def people_list(num_people):
    result = []
    for i in xrange(num_people):
        person = {
                    'id': i,
                    'name': random.choice(names),
                    'major': random.choice(majors)
                }
        result.append(person)
    return result

def people_generator(num_people):
    for i in xrange(num_people):
        person = {
                    'id': i,
                    'name': random.choice(names),
                    'major': random.choice(majors)
                }
        yield person

# t1 = time.clock()
# people = people_list(1000000)
Exemplo n.º 3
0
import mem_profile
import random
import time

names = ['John', 'Corey', 'Adam', 'Steve', 'Rick', 'Thomas']
majors = ['Math', 'Engineering', 'CompSci', 'Arts', 'Business']

print 'Memory (Before): {}Mb'.format(mem_profile.memory_usage_psutil())

def people_list(num_people):
    result = []
    for i in xrange(num_people):
        person = {
                    'id': i,
                    'name': random.choice(names),
                    'major': random.choice(majors)
                }
        result.append(person)
    return result

def people_generator(num_people):
    for i in xrange(num_people):
        person = {
                    'id': i,
                    'name': random.choice(names),
                    'major': random.choice(majors)
                }
        yield person

# t1 = time.clock()
# people = people_list(1000000)
            'database': 'py_dbtest'
        })
else:
    trx = TransactionManager(
        driver, {
            'dsn': 'MSSQLServer',
            'host': '192.168.0.9',
            'port': '1433',
            'user': '******',
            'password': '******',
            'database': 'veritrade'
        })
daoDelegate = DAODelegateTest()
dao = DatabasePersistence(trx, daoDelegate)

memb = mem_profile.memory_usage_psutil()
print('Memory (Before): {}Mb'.format(memb))
t1 = time.clock()

constraint = Constraints()
constraint.offset = 0
constraint.limit = 50

if driver == 'pgsql':
    constraint.add_filter_field('issotrx', True, Constraints.FilterType.EQUAL)
    constraint.add_filter_field('c_bpartner_id', 1009790,
                                Constraints.FilterType.NO_EQUAL)
    constraint.add_filter_field('c_groupdoc_id', None,
                                Constraints.FilterType.NO_EQUAL)
    constraint.add_filter_field('docaction', 'cl',
                                Constraints.FilterType.IPARTIAL)