Hi Gareth,
I don't mean to be annoying but something is bothering me.
Could you please try the sequence of experiments below.
1. Using the data.xls file above, run:
Code: Select all
tic
wfcreate a 1995 2015
for %sheet sheet1 sheet2 sheet3 sheet4 sheet5
read(t,s={%sheet},d4) data.xls 5
next
!elapsed = @toc
statusline !elapsed seconds
The average of five runs is 0.08 seconds.
2. Now run:
Code: Select all
tic
wfcreate a 1995 2015
for %sheet sheet1 sheet2 sheet3 sheet4 sheet5
%range=%sheet+"!c1:x8"
import data.xls range=%range byrow
next
delete series02 series03
!elapsed = @toc
statusline !elapsed seconds
This averages 0.16 seconds, an average of 2.3 times slower than Experiment 1.
3.Now, save the file in .xlsx format (which is what I would normally do when not using 'read') and run:
Code: Select all
tic
wfcreate a 1995 2015
for %sheet sheet1 sheet2 sheet3 sheet4 sheet5
%range=%sheet+"!c1:x8"
import data.xlsx range=%range byrow
next
delete series02 series03
!elapsed = @toc
statusline !elapsed seconds
This takes on average 0.99 seconds, which is 14 times slower than Experiment 1.
The data.xls(x) file is just an example for this posting. Using my actual data (Excel) file, which has around 40 worksheets:
- Using 'read' averages 0.23 seconds
- Using 'import' (with a .xlsx file) averages 17.24 seconds, which is 88 times slower
- Using 'import' (with a .xls file) averages 1.55 seconds, which is 8 times slower.
I've noticed the statusline saying 'Uncompressing file' when I use 'import' with a .xlsx file.
I guess my question is: Why is using 'import' (which is what I want to use) so much slower than using 'read'? [Using import is far quicker with an Excel 2003 file but still considerably slower than using read.]
If this is just the way it is then no worries. But I am just wondering how I can make wfopen/import work for me since I wanna move away from using read, but when it takes almost 20 seconds to run a program it is a bit annoying.
Thanks for looking at this.
Vlad.