1. Spreadsheet on Eu

I have a question for developers that know Eu internals. I miss a text mode spreadsheet.

"For MS Excel 2010, Row numbers ranges from 1 to 1048576; in total 1048576 rows, and Columns ranges from A to XFD; in total 16384 columns."

I said: Why not?

sequence line 
line = repeat ("", 16384) 
 
sequence sheet 
sheet = repeat(line, 2000000) 
 
sheet[1][1]=1 
sheet[1][2]=2 
sheet[1][3]=3 
sheet[1][4]=4 
sheet[1][5]=5 
 
for i=1  to 5 do 
    ? sheet[1][i] 
end for 
 

Runs very quick! I supossed will take longer time. Does the interpreter create the whole structure of 16K columns and 2M Rows when I declare the sequence? Or is the structure created on demand when I put data inside?

I was thinking a simple spreadsheet may work simple with two sequences: One for formulas and another sequence for calculation results.

Regards

Marco Achury

new topic     » topic index » view message » categorize

2. Re: Spreadsheet on Eu

achury said...

Does the interpreter create the whole structure of 16K columns and 2M Rows when I declare the sequence? Or is the structure created on demand when I put data inside?

No and yes. As-is, that program will require 8MB+128K. It would need at least 32GB if you populated every cell (more if cells are not integer).

Here, the width is more critical than the depth. Unused lines will never waste more than 8MB, whereas if you only need 1000 columns, each line you do populate will waste 60K, which could amount to 30GB of the 32GB just mentioned.

The numbers given are for 32-bit, double them for 64-bit.

Since "" is a reference whereas 0 is not, using 0 for unpopulated cells could make your program significantly faster (but obviously the difference is neglible for the example given).

Pete

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu