четверг, 17 ноября 2016 г., 12:30:03 UTC+3 пользователь Cédric Krier написал: > > On 2016-11-17 09:55, Albert Cervera i Areny wrote: > > > - find better than deepcopy: > > > > http://hg.tryton.org/trytond/file/default/trytond/model/model.py#l46 > > > > I'm not sure of what I'll say, but AFAIU deepcopy is used to support > > several databases (with different modules). Would it be possible to > > pass a "--single-database" parameter to trytond, so it would just > > support a single database but it would also avoid deepcopying? Or is > > there much more work than that? > > It is not only for multi-database. For example, a common pattern (which > probably should be removed) is to have a global variable STATES which is > used in Selection. If another module extend the Selection field, we do > not want it to change the global STATES variable. > > Indeed what I was suggesting is not to remove the feature because it is > quite convenient (remember old version where copy should be done on any > modified field attribute). I think the deepcopy could be improved by > limiting what is copied. This could be done by creating __copy__ method > on fields (like: Function and Property). > But first, it has to be proven that deepcopy on this case is slow and > memory consuming. > > -- > Cédric Krier - B2CK SPRL > Email/Jabber: cedric...@b2ck.com <javascript:> > Tel: +32 472 54 46 59 > Website: http://www.b2ck.com/ >
I can confirm, that `deepcopy` is indeed slow. It takes about 95% of the whole running time of __setup__, and removing it boosts the whole Pool building process like for 60% (i.e. on my tests it was "before" - 1sec, "after" - 400ms). We're now trying to understand, how can we remove it, or make it lighter. Will definitely share our conclusions later on, when ready. -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/a88f06e4-3485-4eaa-939e-1ab81eec164d%40googlegroups.com.