User Tools

Site Tools


This is an old revision of the document!

GDXXRW is slow

  • Use a parameter file instead of several gdxxrw calls:
* this is slow
execute 'gdxxrw.exe res.gdx par=TKBF   rng=stat!b2';
execute 'gdxxrw.exe res.gdx par=MKBF   rng=stat!b4';
execute 'gdxxrw.exe res.gdx par=TBKF   rng=stat!b6';
execute 'gdxxrw.exe res.gdx par=alpha  rng=stat!b8';
execute 'gdxxrw.exe res.gdx par=v_s    rng=stat!b10';
execute 'gdxxrw.exe res.gdx par=PKF    rng=stat!b12';
execute 'gdxxrw.exe res.gdx par=TKF    rng=stat!b14';
execute 'gdxxrw.exe res.gdx par=TSCK   rng=stat!b16';
execute 'gdxxrw.exe res.gdx par=Abs    rng=stat!b18';
execute 'gdxxrw.exe res.gdx par=Ant    rng=stat!b20';
* this will be faster
par=TKBF    rng=stat!b2
par=MKBF    rng=stat!b4
par=TBKF    rng=stat!b6
par=alpha   rng=stat!b8
par=v_s     rng=stat!b10
par=PKF     rng=stat!b12
par=TKF     rng=stat!b14
par=TSCK    rng=stat!b16
par=Abs     rng=stat!b18
par=Ant    rng=stat!b20
execute 'gdxxrw.exe res.gdx @2excel.txt';
  • Do not share the workbook: Microosft Excel offers a functionality called shared workbook which allows several people or even applications editing a shared workbook simultaneously. However enabling that functionality decreases the performance of gdxxrw substantially. Below is an example, which illustrates this:
Illustrate the difference when updating a shared or non-shared workbook
xlstalk is used to open and close the file; the user has to save the
workbook as shared to illustrate the difference.

Note that for very small updates the time difference is not so dramatic

set i /i1*i400/
    j /j1*j255/;

parameter A(i,j);

execute_unload 'f1.gdx', i, j, A;

*close in Excel and delete
execute 'xlstalk.exe -C f1.xls';
execute 'rm f1.xls';

*create the file
execute 'gdxxrw.exe f1.gdx output=f1.xls par=A dim=2 rng=sheet1!A1 trace=0';
* write again to show the time for an existing file
execute 'gdxxrw.exe f1.gdx output=f1.xls par=A dim=2 rng=sheet1!A1 trace=1';

* open the file in Excel
execute 'xlstalk -O f1.xls';
* wait for the user the save the file shared and close the file
execute 'xlstalk -W f1.xls';
*see timing difference when the file is shared but closed
execute 'gdxxrw.exe f1.gdx output=f1.xls par=A dim=2 rng=sheet1!A1 trace=1';

*open in Excel and get timing when the file is open
execute 'xlstalk -O f1.xls';
execute 'gdxxrw.exe f1.gdx output=f1.xls par=A dim=2 rng=sheet1!A1 trace=1';
* the user has to save the file to see the changes
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY interfaces/gdxxrw_is_slow.1622721979.txt.gz ยท Last modified: 2021/06/03 14:06 by Atharv Bhosekar