The following code is broken in trunk:

db = DAL('sqlite://test.sqlite')
db.define_table('t',Field('x'))
db.t.insert(x=1)
db(db.t).select(db.t.id,db.t.x+1).first()(db.t.id)

Throws AttributeError: 'Row' object has no attribute 'id'

The point seems to be the _extra entry created in the row object if we have 
a computed value in the select.


Am Sonntag, 26. August 2012 14:47:35 UTC schrieb Massimo Di Pierro:
>
> Michele, Jonathan, Bruno, Anthony and I have continued test possible ways 
> to improve web2py code.
>
>     We have lazy tables in trunk and they can increase the speed of your 
> code a lot but require minor rewrites of models.
>
> We are also looking at ways to improve the speed of your code without any 
> rewrite and we have some important changes in trunk.
> They really need to be tested to make sure they do not break backward 
> compatibility.
>
> accessing:
>     request.<anything> 
>     response.<anything> 
>     session.<anything> 
> as you can imagine this is everywhere. this is a major bottleneck. We made 
> it 2-3x faster
>
> accessing:
>    db.<tablename>
> we made this 2x faster
>
> accessing:
>    db.<tablename>.<fieldname>
> we made this 20x faster (not a typo, 20x)
>
> Given row = db(db.table).select()[0]
> accessing:
>    row.<fieldname>
> This is also a major bottleneck. We make this 10x faster.
>
> WE NEED TESTERS. Does the latest trunk/nightly built break your app?
>
> WE NEED INDEPENDENT BENCHMARKS AGAINST 1.99.7. Here is the code to 
> benchmark:
>
> -------------
> import time
> db=DAL()
> db.define_table('person',Field('name'))
> db.test.insert(name='one')
> n = 100000
>
> t0 = time.time()
> for k in range(n):
>     y = db.person.name
> print (time.time()-t0)/n
>
> row = db(db.person).select().first()
>
> t0 = time.time()
> for k in range(n):
>     y = row.name
> print (time.time()-t0)/n
> ----------
>
> Massimo
>

-- 



Reply via email to