Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The maximum size of a multidimensional array
#2
(01-22-2024, 11:06 AM)Zuzikofon Wrote: Hello.

A great programming language, very well thought out - the quintessence of what you need. Congratulations.

Question - what is the maximum size of array ?
Can it be enlarged?
In a one-dimensional array I managed to get to 1 million.
Below are sample data that I want to convert. I will write a CSV to array parser. However, there are e.g. 30 million rows of this data.
How to do it?

20210103 170000;3.724250;3.724550;3.724250;3.724250;0
20210103 170500;3.723850;3.725150;3.723650;3.724160;0
20210103 170600;3.724160;3.724160;3.723850;3.723850;0
20210103 170700;3.724250;3.724460;3.724250;3.724460;0
20210103 170800;3.724450;3.724450;3.722350;3.722350;0
20210103 170900;3.722150;3.723950;3.722150;3.723950;0
20210103 171000;3.724750;3.724750;3.724750;3.724750;0
20210103 171100;3.722850;3.723160;3.722560;3.723160;0
20210103 171200;3.723050;3.724250;3.723050;3.724250;0
20210103 171500;3.724150;3.724250;3.723250;3.723250;0
20210103 171900;3.723260;3.723450;3.722450;3.722460;0
20210103 172000;3.722950;3.723350;3.720850;3.723350;0
20210103 172100;3.724250;3.724250;3.724250;3.724250;0
20210103 172200;3.724260;3.724260;3.724150;3.724150;0

I'm glad you like naalaa, but I'm not sure if it's a good language for data processing of that kind. Actually, I'm pretty sure it's a terrible choice of language for that Big Grin

Parsing a csv file shouldn't be much trouble. Simplified (everything put into a 2D array of strings):

Code:
' Content of data.csv:
' Thing;Number;Count;Name
' boat;13;42;Sven
' goat;141;1;August
' dude;1091.2;32;Johnny

data = []
' Open file.
f = openfile("data.csv")
if file(f)
    ln = frln(f) ' Try read a line of data from file.
    while ln <> unset ' If nothing could be read, an unset (null) variable is returned.
        ' Just split the string at every ; character and put it in the data array.
        data[sizeof(data)] = split(ln, ";")
        ' You could also have used the first line of the CSV (if it has a header) to create key and
        ' value pairs for the data in each row, so that data[n].Name contains the Name column for a
        ' row. Also, as it is now everything is stored as string.
        ' Try read next line.
        ln = frln(f)
    wend
    free file f
endif

' Print.
if sizeof(data)
    for i = 0 to sizeof(data) - 1
        for j = 0 to sizeof(data[i]) - 1  write data[i][j] + chr(9)
        wln
    next
else
    pln "Something went wrong"
endif

system "pause"

But I assume your problem is all about the memory. You can try adding a line like this somewhere at the top of your program:

Code:
#mem128000000

Memory is complicated in n7. A program starts with one "bucket" of memory and if it runs out of memory and garbage collecting doesn't help, it creates a second bucket. I think it can create a maximum of 10 buckets, but I'm not sure. "#mem", directly followed by a value, sets the bucket size in bytes. The default value is 8388608.

Also note that data will eat up a lot more memory than what anyone can think makes sense. Sorry Smile
Reply


Messages In This Thread
RE: The maximum size of a multidimensional array - by Marcus - 01-22-2024, 05:09 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)