← Back to team overview

openerp-expert-accounting team mailing list archive

general ledger optimization

 

I'm working on the accouting reports, the first issue was the performance of the general ledger report.

I optimized the database access the complexity is now O(account nbr) instead of O(move_line nbr) with only a gain of +/- 35%.

https://code.launchpad.net/~al-openerp/openobject-addons/trunk_account_ledger/

The next bottleneck is the report engine itself i will investigate this now.

Any comment is welcome.

I use the following query repeated to fill the database: (duplicate line while keeping the account_move)

insert into account_move_line (journal_id,currency_id,partner_id,company_id, state, debit,credit,account_id,date,move_id,period_id,name) select journal_id,currency_id,partner_id,company_id, state, debit,credit,account_id,date
,move_id,period_id,name from account_move_line;

Profiling for 320 account_move_lines Before/After

create_pdf (/home/wis/stuff/version/openerp/bazaar/openerp_openobject-server_trunk/bin/report/interface.py:182)
function called 1 times

         3563575 function calls (3548756 primitive calls) in 56.848 CPU seconds

   Ordered by: cumulative time, internal time, call count
   List reduced from 648 to 40 due to restriction <40>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000   56.892   56.892 interface.py:182(create_pdf)
        1    0.000    0.000   56.892   56.892 render.py:47(render)
        1    0.000    0.000   56.892   56.892 rml.py:41(_render)
        1    0.001    0.001   56.892   56.892 trml2pdf.py:806(parseNode)
        1    0.000    0.000   56.890   56.890 trml2pdf.py:199(render)
        1    0.000    0.000   56.872   56.872 profilehooks.py:219(new_fn)
        1    0.000    0.000   56.872   56.872 profilehooks.py:310(__call__)
        1    0.000    0.000   56.872   56.872 trml2pdf.py:792(render)
     11/1    0.000    0.000   37.719   37.719 trml2pdf.py:713(render)
     11/1    0.001    0.000   37.719   37.719 trml2pdf.py:714(process_story)
  3654/12    0.335    0.000   37.243    3.104 trml2pdf.py:585(_flowable)
     11/6    0.278    0.025   37.182    6.197 trml2pdf.py:491(_table)
        1    0.070    0.070   19.153   19.153 doctemplate.py:848(build)
       43    0.004    0.000   19.017    0.442 doctemplate.py:735(handle_flowable)
5548/4248    0.838    0.000   18.556    0.004 {eval}
    16069    0.512    0.000   17.360    0.001 utils.py:54(_child_get)
5 0.097 0.019 16.282 3.256 general_ledger_landscape.py:251(lines)
       42    0.004    0.000   14.123    0.336 frames.py:136(_add)
     6304    0.108    0.000   13.132    0.002 orm.py:289(__getattr__)
     6304    0.892    0.000   13.024    0.002 orm.py:170(__getitem__)
     3633    0.322    0.000   10.971    0.003 trml2pdf.py:127(para_style_get)
14118/14022    0.621    0.000   10.710    0.001 tables.py:357(_listCellGeom)
     1492    0.228    0.000   10.365    0.007 orm.py:2679(read)
     4518    0.066    0.000   10.153    0.002 sql_db.py:70(wrapper)
     2259    0.353    0.000   10.063    0.004 sql_db.py:105(execute)
     1492    0.732    0.000    9.401    0.006 orm.py:2735(_read_flat)
     3633    1.752    0.000    9.398    0.003 styles.py:204(getSampleStyleSheet)
14140/14044    0.148    0.000    9.337    0.001 flowables.py:113(wrapOn)
    14135    0.618    0.000    9.173    0.001 paragraph.py:834(wrap)
    62/51    0.003    0.000    8.787    0.172 tables.py:552(_calc)
    62/51    0.749    0.012    8.779    0.172 tables.py:469(_calc_height)
    14135    1.467    0.000    8.260    0.001 paragraph.py:972(breakLines)
  3653/26    0.133    0.000    8.098    0.311 flowables.py:101(drawOn)
  3653/26    0.036    0.000    8.084    0.311 flowables.py:84(_drawOn)
    19/14    0.055    0.003    8.082    0.577 tables.py:1265(draw)
3616/3586    0.416    0.000    7.998    0.002 tables.py:1345(_drawCell)
    50851    2.230    0.000    6.303    0.000 styles.py:29(__init__)
    46/38    0.001    0.000    6.047    0.159 tables.py:1080(wrap)
2259 5.917 0.003 6.038 0.003 {method 'execute' of 'psycopg2._psycopg.cursor' objects} 320 0.065 0.000 5.714 0.018 general_ledger_landscape.py:73(_calc_contrepartie)


create_pdf (/home/wis/stuff/version/openerp/bazaar/openerp_openobject-server_trunk/bin/report/interface.py:182)
function called 1 times

         2736336 function calls (2722989 primitive calls) in 36.242 CPU seconds

   Ordered by: cumulative time, internal time, call count
   List reduced from 642 to 40 due to restriction <40>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000   36.281   36.281 interface.py:182(create_pdf)
        1    0.000    0.000   36.281   36.281 render.py:47(render)
        1    0.000    0.000   36.281   36.281 rml.py:41(_render)
        1    0.001    0.001   36.281   36.281 trml2pdf.py:806(parseNode)
        1    0.000    0.000   36.277   36.277 trml2pdf.py:199(render)
        1    0.000    0.000   36.253   36.253 profilehooks.py:219(new_fn)
        1    0.000    0.000   36.253   36.253 profilehooks.py:310(__call__)
        1    0.000    0.000   36.253   36.253 trml2pdf.py:792(render)
     11/1    0.000    0.000   19.700   19.700 trml2pdf.py:713(render)
     11/1    0.001    0.000   19.700   19.700 trml2pdf.py:714(process_story)
  3654/12    0.309    0.000   19.222    1.602 trml2pdf.py:585(_flowable)
     11/6    0.248    0.023   19.171    3.195 trml2pdf.py:491(_table)
        1    0.063    0.063   16.553   16.553 doctemplate.py:848(build)
       43    0.004    0.000   16.422    0.382 doctemplate.py:735(handle_flowable)
       42    0.004    0.000   13.167    0.314 frames.py:136(_add)
14118/14022    0.587    0.000    9.975    0.001 tables.py:357(_listCellGeom)
     3633    0.299    0.000    9.812    0.003 trml2pdf.py:127(para_style_get)
14140/14044    0.145    0.000    8.693    0.001 flowables.py:113(wrapOn)
    14135    0.580    0.000    8.528    0.001 paragraph.py:834(wrap)
     3633    1.576    0.000    8.437    0.002 styles.py:204(getSampleStyleSheet)
    62/51    0.003    0.000    8.199    0.161 tables.py:552(_calc)
    62/51    0.705    0.011    8.190    0.161 tables.py:469(_calc_height)
  3653/26    0.123    0.000    7.691    0.296 flowables.py:101(drawOn)
  3653/26    0.033    0.000    7.683    0.296 flowables.py:84(_drawOn)
    19/14    0.050    0.003    7.681    0.549 tables.py:1265(draw)
    14135    1.363    0.000    7.667    0.001 paragraph.py:972(breakLines)
3616/3586    0.388    0.000    7.602    0.002 tables.py:1345(_drawCell)
    50851    2.032    0.000    5.675    0.000 styles.py:29(__init__)
    46/38    0.000    0.000    5.508    0.145 tables.py:1080(wrap)
3984/3633    0.133    0.000    4.310    0.001 trml2pdf.py:477(_textual)
     4029    0.379    0.000    4.010    0.001 utils.py:98(_process_text)
     3633    0.040    0.000    3.445    0.001 paragraph.py:802(__init__)
     3633    0.109    0.000    3.405    0.001 paragraph.py:816(_setup)
    37902    2.269    0.000    3.262    0.000 {_rl_accel.stringWidthU}
     3633    0.046    0.000    3.141    0.001 paragraph.py:966(draw)
     3633    0.394    0.000    3.095    0.001 paragraph.py:1264(drawPara)
       16    0.000    0.000    3.048    0.190 frames.py:191(split)
       16    0.000    0.000    3.047    0.190 tables.py:1257(split)
    50851    2.443    0.000    2.732    0.000 styles.py:58(refresh)
5548/4248    0.776    0.000    2.532    0.001 {eval}




Follow ups