I upgraded my web2py from 2.3.2 to 2.14.6. Then made all required changes like updating/replacing web2py.js
, jquery.js
,web2py_ajax.html
, appadmin.py
, appadmin.html
. Then made few css changes to match old UI. Did no changes in backend code.
Now when I visit application page containing web2py grid (SQLFORM.grid()
) on web2py 2.14.6, it takes 34.775 seconds and on version 2.3.2 same page with same number of records it takes 0.686 seconds.
Grid has around 4600 records. Pages that doesn't have grid, took approx same time to load on both versions.
I did time profiling and found that gluon/html.py
is taking most of the time.
Time profiling results
2.3.2 : https://paste.ubuntu.com/23602259/
2.14.6 : https://paste.ubuntu.com/23602261/
Also I added print statement before and after grid definition, It took 18 seconds on 2.14.6 and 10 miliseconds on 2.3.2.
SQLFORM.grid()
definition is similar to following:
grid = SQLFORM.grid(query,
create=True,
csv=False, deletable=False, searchable=search_query,
showbuttontext=False, links=links, links_placement='left',
maxtextlengths=textlengths, upload=URL('download'),
fields=[db.notice.UIN, db.notice.classname, db.notice.title,
db.notice.type,
db.notice.description,
db.notice.due_date, db.notice.status,
db.notice.risk, db.notice.consequence,
db.notice.document,
db.notice.other])
sample query in above grid-
((((user_notice.notice = notice.id) AND (user_notice.auth_user = 19)) AND
(notice.status IN ('Closed','Open','New'))) AND
(notice.due_date IS NOT NULL))
I tested this on my local computer- Ubuntu 14.04,Python 2.7.6 and mysql db.
Why newer version takes more time to load grid? Is there any changes required in application code after upgrade?
Please help me to solve this issue.
Thank you