Results 1 to 7 of 7

Thread: Print invoice very slow

  1. #1
    New user
    Join Date
    02-01-11.
    Posts
    7

    Default Print invoice very slow

    To print an invoice in Isotope is very slow.
    I don't know if the problem is in Contao or Isotope, but using older versions of both Contao and Isotope it was fast (on a hosted website ca. 1 second, now ca. 35 seconds... and sometimes the script times out). This happens on other servers as well.

    When i tested on my desktop computer I noticed that the older versions didn't use alot of CPU, but now with the lastest versions of both Contao (2.9.5) and Isotope (0.2.9.5) my dual-core CPU goes to almost 100% on both cores and it takes about 10 sec.

    This is quite serious, as on other servers it is impossible to get invoices to print at all because of script timeout.

    It seems more lika a Contao issue, but it rears it's ugly head in Isotope.

    Has anybody else had the same problem?

  2. #2
    User winanscreative's Avatar
    Join Date
    06-21-09.
    Location
    Massachusetts, United States
    Posts
    261

    Default Re: Print invoice very slow

    We've been doing some query/data access optimization in the latest builds that I think should fix the problem. Are you printing multiple invoices or just a a single one?

  3. #3
    New user
    Join Date
    02-01-11.
    Posts
    7

    Default Re: Print invoice very slow

    I'm printing just one single invoice.

    If this helps at all I uploaded an Xdebug function trace file:
    http://teambeyond.com/contao295.xt (almost 19MB)

    The setup is as follows:
    WampServer Version 2.0 (PHP 5.3.0)
    Contao 2.9.5
    Isotope 0.2.9 b5

    Without Xdebug running it takes 15 seconds with about 90% CPU load, with Xdebug running it takes about 20 seconds with same 90% CPU utilization until the PDF is ready, just to show that it isn't Xdebug that makes it too slow for use.

    As noted before, the same problem is happening on hosted servers as well.

    TCPDF runs these 2 functions many times and most of the time is spent there:
    TCPDF->_getULONG() 10820 times
    TCPDF->_getULONG() 2709 times

    The constructed PDF contains 407 characters and one logo image.

    Sadly I don't really remember what version on Contao and Isotope I had on my developement/test computer when the PDF rendering was fast (about 1 second). Perhaps it was Contao 2.9.1 or 2.9.2 and Isotope 0.2.5 or some similar.

  4. #4
    User winanscreative's Avatar
    Join Date
    06-21-09.
    Location
    Massachusetts, United States
    Posts
    261

    Default Re: Print invoice very slow

    That function has to do with font-embedding. So I did some experimenting and if you do the following it should speed things up. However, you will likely fallback to the standard freeserif font:

    For Isotope 2.9.5 > In dca > tl_iso_orders.php line 632. Comment out this line:

    Code:
    $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);
    That should speed things up dramatically. I just tested it out on the demo store and it worked like a charm.

    Note that in future Isotope versions (1.3, available as a beta via SVN) this function is moved into IsotopeProductCollection.php.

  5. #5
    New user
    Join Date
    02-01-11.
    Posts
    7

    Default Re: Print invoice very slow

    Thank you for your fast reply.

    Now the rendering is back to 1 second or so. And I can't notice any difference in the look of the invoice, so I'm happy with this

    Hopefully others get help by this thread, as I have had the same problems on 3 hosted servers and my own computer. So I think others must have had the same problem too.

  6. #6
    User winanscreative's Avatar
    Join Date
    06-21-09.
    Location
    Massachusetts, United States
    Posts
    261

    Default Re: Print invoice very slow

    Yeah... I didn't look too much into WHY it was happening, that just happened to fix it. I'll do some more digging and see if it is something on the Contao or Isotope side but I have a feeling it's related to the way tcpdf handles font embedding.

  7. #7
    PamBam
    Gast

    Default Re: Print invoice very slow

    Hiya, folks! Sorry for the late response, but I was curious to know if this particular invoice issue was resolved. I was having the same type of issue as Tomo here and I still can't seem to fix the problem. As someone who works in billing and payroll, one can see how this would be a tad frustrating. Ha!

    Anyway, ANY help would be super appreciated. Feel free to PM me. Thanks! :D

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •