[Erp5-dev] Sale Supplies - problem with performance, some other questions

Sébastien Robin seb at nexedi.com
Fri Jun 8 16:27:04 CEST 2007


Le Wednesday 06 June 2007 10:32:15 Łukasz K. Nowak, vous avez écrit :
> Hello,
>
> Dnia 05-06-2007, wto o godzinie 14:33 +0200, Łukasz K. Nowak napisał(a):
> > On fresh revision (14673) I've create site with erp5_[base,trade,pdm].
> >
> > There I've created 2 resources: 'car' and 'wheel'.
> >
> > I've created 2 organisations: 'we' and 'them'.
> >
> > I've created Sale Supply, which has destination 'them'.
> >
> > In those Sale Supply I've created one Sale Supply Line for 'car' and 550
> > for 'wheel'.
> >
> > I've patched 'SupplyLine_asPredicate' with:
> > script.log('%s'%(context.getRelativeUrl()))
> >
> > I've created Sale Order from 'we' to 'them'. I added Sale Order Line,
> > set resource to 'car' and...system is invoking 551 times
> > 'SupplyLine_asPredicate' on every line in Sale Supplies - for every line
> > from this Sale Supply.. Huh - its quite performance disaster, I've seen,

When is it called 551 times ? When you create new lines ?

If I remember correctly it might be called when it tries to get a price for 
your line. And if we call each time the method you said, this is because we 
are looking for a price for every line. And the price does not depend only 
about the resource, it can depends on quantity, variation... wich might be 
different for every line. So this is not that easy to do optimisation.

> > that there might be many invocations of such predicate search.
> >
> > I was just curious, and added default_supply_line to both resources -
> > only that 'correct' one was searched.
> >
> > Is it bug or feature?
>
> Well. After playing some with Purchase and Sale Supplies in one system,
> I've seen, that for given context (eg. Sale Order Line) all *Supply
> Lines are searched. I've found, that patching Resource with given patch
> make this search narrowed to only proper context (it is still much, but
> in our system it is making things almost 2 times faster).

There is a discussion about predicate and performance here :
http://erp5.org/Discussion/PredicatesPerformances

Your patch is only Sale and Purchase specific, this is not generic, so we 
should not apply. But I understand that it makes the research faster. 

So the discussion might be updated, and time must be found in order to improve 
well that part.

  Seb.

>
> Any comments welcome.
>
> Thanks,
> Luke



-- 
Sebastien Robin, Nexedi Project Manager
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Free / Open Source ERP Software for small and medium companies
http://www.erp5.org



More information about the Erp5-dev mailing list