Raised This Month: $ Target: $400
 0% 

multiple vs single array handler


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-26-2021 , 09:29   multiple vs single array handler
Reply With Quote #1

Hello, suppose I've an item which will contain an unknown number of sub-items. Since the amount of sub-items that the array will have to store is unknown, it's size has to be dynamic. For that I will use cellarray, but I was wondering, which one of the two methods below would be optimal?

Create one array for each item:

Code:
item 1 => ["sub-item 1", "sub-item 1"]

item 2 => ["sub-item 2", "sub-item 2", "sub-item 2"]

item 3 => ["sub-item 3"]

Or store everything in a single array, would look like this:

Code:
["sub-item 1", "sub-item 1", "sub-item 2", "sub-item 2", "sub-item 2", "sub-item 3"]

"item 1" sub-items: 0-1
"item 2" sub-items: 2-4
"item 3" sub-items: 5
__________________








CrazY. is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode