Jump to content
Macro Express Forums

Practical application of Arrays


Recommended Posts

I have been using multiple array variables as tables of data but I've had a questing in the back of my mind that hasn't been important until now. The problem is how many elements do I define when I don't know how many 'rows' of data I will have. Up until now I've know my tables would be less than 999 so I would just use that but now I'm writing a macro that might eventually have very large and as of now unknown data sets. Now I checked it out and found that I can create as many as 2,147,483,647 (2^32/2-1) elements which will for sure be way more than enough but would there be a drawback if I used this value? I can use a smaller value if so but if it's important not to have too large a value I will make this as close as possible but now I will need to add some test to make sure before hand the set its not to large.

 

The other related question is if there is a way to somehow set the array elements dynamically.

 

Thoughts?

Link to comment
Share on other sites

No, it would not be a good idea to include that many elements. Six bytes of memory are allocated for each element. I don't think you would be able to even run the macro if you added 2+ billion elements.

 

As to your other question, there is not a way to dynamically change the number of elements in an array. The number needs to be set up front.

Link to comment
Share on other sites

Any idea about where it would start to bog down? I've used them up to 1,000 and had no problems. At least I'm assuming to large of an array would just create a performance hit. In this one application I was thinking of I spit balled a worse case and it was around half a million and the bits of data would be small over about 7 variables. Is a million elements going to be as bad of a problem? I'm just trying to get a rough idea here where I might start having troubles.

 

I'm just thinking that ASCII File Repeat might be slower. Maybe I'll have to make a new dyno macro and do some testing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...