In the book under "Efficiency Tricks" it says: Set session.forget() in all controllers and/or functions that do not change the session. Does this new change make it unnecessary to bother calling session.forget() in most cases because sessions are no longer saved when empty or not modified? Thanks. Anthony
On Monday, March 14, 2011 11:40:38 PM UTC-4, Massimo Di Pierro wrote: > At PyCon some people have suggested that they would like the ability > to switch off some web2py functionality to make it faster. I never > thought of this being an issue because I do not think web2py does much > outside models/views and controllers. > > I run a lot of tests today using a barebone > > def index(): return 'hello world' > > controller (no view, no model) and I discovered, to my surprise that > even in this simple case, web2py spends huge amount of time saving > sessions even if not used (~40ms/request on my laptop). This is also a > problem because if you have many passive visitors web2py creates a lot > of empty session files that fills the sessions folder and slow down > the file system even more. > > I made some changes so that sessions are no longer saved if not > modified or empty. For my simple code, the running time went down to > 4ms/request. That is 10x than before. That is only 5x the bare Rocket > or Tornado speed (considering it is still checking for session, doing > routing, parsing input and performing a lot of checks, and a lot of > other stuff). > > I do not think it should break anything and you should feel it > snappier immediately. Give it a try and let me know. > > Try run ab -n 1000 with both web2py 1.93.1 and trunk for your app. Let > me know what you get. > > Enjoy! > > Massimo > >

