On Friday, September 16, 2016 at 2:16:28 PM UTC-4, Dave S wrote:
> You're going to have at least a minimal view (generic.json, frex) to 
> provide the headers and the HTTP 200.

You do not need a view in order to have headers set or return an HTTP 
response -- that can all be done from a controller or even a model. 
Executing views adds overhead, so you should only use them if needed.

> But my understanding is that the models can be the slowest part of web2py 
> (as opposed to the backend), so using conditional models or moving extra 
> models out to the modules can be useful.

It's not that models in general are particularly slow, just that if you 
have many model files executing on every request, that may be adding 
unnecessary overhead if you don't really need everything being defined in 
each file on every request. All things being equal, if you execute and 
return a response from a single model file (e.g., via raise HTTP(...)), 
that should actually be a bit faster than executing and returning the same 
response from a controller file (with no model files), as the latter 
involves some additional framework code execution, including making a copy 
of the entire web2py environment.


- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to