Categories > OpenTBS with XLSX >

Data dependant processing time

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jo
Date: 2014-10-27
Time: 11:47

Data dependant processing time

Hi.
I'm fairly new to tbs stuff but on the entry level, the simplest example I tried proved being tricky.

require_once('TinyButStrong/tbs_class.php');
require_once('TinyButStrong/plugins/tbs_plugin_opentbs.php'); // Load the OpenTBS plugin
// generate some random data
$row = array();
for ($i=0;$i<100;$i++) { $row["a$i"] = "a"; }
//die('[data.'.implode("]\t[data.",array_keys($row)).']');
$report = array();
for ($i=0;$i<1000;$i++) { $report[] = $row; }

        $TBS = new clsTinyButStrong;
        $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load the OpenTBS plugin
        $TBS->LoadTemplate('template.xlsx');
        $suff = '-'.date('Y-m-d');
        $TBS->MergeBlock('data', $report);
        $TBS->Show(OPENTBS_FILE, 'report'.$suff.'.xlsx');
template.xlsx holds simple:
[data.a0;block=row][data.a1][data.a2][data.a3]...[data.a99]
(if you uncomment line below data generation in above code it'll print it for you - except for ";block=row" part)

...and the processing time of data rises by x squared (and some) with dataset length.
Ffor 100 rows it takes 1,2s, for 500 rows - 10s and for 1000 rows it takes whopping 33s.
That is for opentbs plugin version 1.9.2.

However...  When I used earlier version (1.7.4 in my case) the times are 0.016, 0.061 and 0.107 respectively.
Hence my suspicion of a bug in latest version of this plugin...

Or perhaps I'm doing it wrong, and I'd be grateful for a hint what is it.
By: Geo
Date: 2015-01-15
Time: 19:37

Re: Data dependant processing time

Did you ever find a solution to the exponential increase in processing time?
I am experiencing similar issues, trying to produce an .xlsx document with over 1000 rows is taking way too long.
By: Jo
Date: 2015-01-27
Time: 11:54

Re: Data dependant processing time

Nope, but I'm once again with my back against the wall with that.

I need to use version 1.9.0 (at least) due to (supposedly solved there) issue >>XLSX warning for corrupted subfile "/xl/calcChain.xml-Part".<< so I'll be looking into it once more...
By: Jo
Date: 2015-01-29
Time: 13:50

Re: Data dependant processing time


So I took closer look into this plugin and the main culprit(s) are

    [Misc_CellRef] => 146.292975
    [MsExcel_ChangeCellValue] => 18.862360
    [MsExcel_ConvertToExplicit_Item] => 562.091641

...and since these functions are not present in earlier versions of the library (1.7.4 in my case) there's probably no easy way around it...
By: Jo
Date: 2015-01-29
Time: 14:49

Re: Data dependant processing time

And here's the solution(?)
        $TBS = new clsTinyButStrong;
        $TBS->OtbsMsExcelExplicitRef = false; //<<< this is what "fixes" the plugin
        $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
I can only guess what is the purpose of this, but it solves the processing time problem and even generates smaller files (~1/3 of the size).
What left is to check whether data in file is correct.
Hope this will help someone too.