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, development server and mysql db.
Why newer version takes more time to load grid? Anything I missed while doing upgrade?
Please help me to solve this issue.
Thank you