Forum


Replies: 8   Views: 3827
Replacevariablebytext very slow
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by AndrewCooper  · 28-06-2016 - 11:29

bbreukelen ,

Be aware that the merge functionality is rather slow as well. It might not allieviate your problem. I'd be interested in hearing whether it did or not since we'll be using the same functionality here at some point. In our application we had originally generated each section of the document (around 10 or 11 sections) as separate documents and then merged them into a single document. The process was taking 3 - 3.5 seconds, which isn't too long unless you are generating numerous documents at a time (which we are). 

The point being, depending on the number of pages you have and are spitting out as individual documents, the time savings might or might not be that great. We solved the issue by dividing our document more logically so that we only split it into 3 or so separate documents and then merged those. That dropped our time to about 0.5 seconds.You'll likely have to do some trial and error to find the sweet spot between number of documents to merge and number of variables to replace per document.

Also note that my numbers are on a development box which is not an impressive machine performance-wise.  The performance on the production box is likely better but the load there is significantly more as well.

Andrew