Thank you Richard, I really appreciate your time to explain it to me.
I think I start understanding it all slowly...

You're right that until I don't have any performance issue I shouldn't try 
to optimize anything. I already created some modules that I import when 
needed (mainly for API calls that I make from Angular, it works really 
great) so a lot of code and functions are there. I will now try to see if 
creating plugins would help at this point or if it is an optimization I 
should do latter on.

As you said, the idea of having conditional models quiet pushes me away as 
I would have to rethink exactly what models depend on others to be able to 
put them in folders... I might get crazy before time :)

Once again thank you for the help!
Best,
Sébastien.

@Steve: I will have a look in the mailing about defining tables inside 
modules. It sounds interesting. Thanks for the info!

On Wednesday, 15 April 2015 15:18:50 UTC+2, Richard wrote:
>
> Sébastien,
>
> Start by making something then when you will need performance you can work 
> on it. I have 155 tables in my app and it is not the model that slow down 
> things... It is more the number of records in these tables that matter so 
> far... I mean, I should use SQLFORM.grid which use paging and load only 
> small amount of records at a time which limit the loading time of grid page 
> which are the page that requires the most processing. You better not define 
> function or class in models files which really degrad performance. You can 
> activate lazy table by respecting some rules when defining your table and 
> set lazy table flag to true (this has no cost and should improve 
> performance). You may also consider models/subfolder which make models file 
> parsing conditionnal to the controller called though it has many chances to 
> make your app less dry (I avoid that)... So as Steve mention there is 
> "Model less app" for which you should found many thread on the mailing-list 
> detailing how to use it. But as I said, just go that way once you really 
> need it. It bring much more work for you and will slow down your pace of 
> developpement if you do that too early.
>
> Richard
>
> On Tue, Apr 14, 2015 at 8:03 PM, 黄祥 <steve.van...@gmail.com <javascript:>> 
> wrote:
>
>> yes, you are right, models executed on every request. but you can use, 
>> model less application (define table using modules, best practice if you 
>> have the same table that been used by more than 1 web2py app) or 
>> conditional models (response.models_to_run)
>> In book you can see an advice :
>>
>>    - Minimize the code in models: do not define functions there, define 
>>    functions in the controllers that need them or - even better - define 
>>    functions in modules, import them and use those functions as needed.
>>
>>
>> ref:
>> http://web2py.com/books/default/chapter/29/04/the-core#Conditional-models
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Model-less-applications
>>
>> http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-tricks
>>
>> best regards,
>> stifan
>>
>> -- 
>> Resources:
>> - 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+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- 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