For me on Linux Ubuntu 12.10 bcr@vaiubuntu:~/projects/web2py21$ python web2py.py -S welcome -N -R ../thisfile.py web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2012 Version 2.00.1 (2012-08-28 14:26:44) rc4 Database drivers available: SQLite3, pymysql, psycopg2, pg8000, IMAP
time to access field obj 8.60691070557e-07 time to select 1000 recods 2.90545892715e-05 time to access field values 5.29289245605e-07 Changed cacheable to True time to access field obj 6.69956207275e-07 time to select 1000 recods 2.16320896149e-05 time to access field values 3.38554382324e-07 Lazy Tables = True time to access field obj 5.79357147217e-07 time to select 1000 recods 2.04881191254e-05 time to access field values 3.60012054443e-07 Using cache.ram t0 = time.time() for k in range(n): rows = cache.ram("test", lambda: db(db.test).select(cacheable=True), 1200) # (*) print 'time to select 1000 recods',(time.time()-t0)/n/1000 row = cache.ram("test", lambda: db(db.test).select(cacheable=True), 1200).first() # (*) t0 = time.time() for k in range(n): y = row.id y = row.one print 'time to access field values',(time.time()-t0)/n time to access field obj 8.60691070557e-07 time to select 1000 recods 3.34150791168e-07 time to access field values 2.59876251221e-07 On Tue, Aug 28, 2012 at 4:43 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > # run with web2py.py -S welcome -N -R thisfile.py > > import time > > db=DAL() > db.define_table('test',Field('one')) > db(db.test).delete() > for k in range(1000): > db.test.insert(one='one') > db.commit() > > n = 100 > t0 = time.time() > for k in range(n): > y = db.test.one > print 'time to access field obj',(time.time()-t0)/n > > t0 = time.time() > for k in range(n): > rows = db(db.test).select(cacheable=False) # (*) > > print 'time to select 1000 recods',(time.time()-t0)/n/1000 > > row = db(db.test).select().first() > t0 = time.time() > for k in range(n): > y = row.id > y = row.one > print 'time to access field values',(time.time()-t0)/n > > """ > > Results: > > > > web2py 1.99.7 > > > > time to access field obj 5.068 (microseconds) > > time to select 1000 recods 38.441 (microseconds) > > time to access field values 7.710 (microseconds) > > total time to access one field for each of 1000 records: 7748 > (microseconds) > > > web2py 2.0 > > time to access field obj 0.579 (microseconds) > > time to select 1000 recods 33.820 (microseconds) > > time to access field values 0.338 (microseconds) > > total time to access one field for each of 1000 records: 371 > (microseconds) > > > web2py 2.0 w cacheable = True (*) > > > > time to access field obj 0.579 (microseconds) > > time to select 1000 recods 24.741 (microseconds) > > time to access field values 0.300 (microseconds) > > total time to access one field for each of 1000 records: 324 > (microseconds) > > > (benhcmarks with SQLite on Mac Air and python 2.7) > > """ > > -- > > > > --