I'd always prefer maintenance over speed. You never know how much issues you will get with too much wasted RAM or illogical code.
You shouldn't be too afraid of maintenance slowing your app down, though. I tested an array with 10000 cells, moving the contents of 9999 by one to the left. I could do this on every tick without touching the v-synced framerate of 60 fps. In your app you will never experience a situation, where you would constantly move 10000 cells per tick.
If you are interested, how actual events would look like (and behave), have a look at Verve!
The sorting algorithm featured there works simultaneously on 4 arrays, moving the contens of cells, deleting entries, inserting data, etc.
If you can find a way of identifying your objects with keys, then you could use a hash table and place all data as a tokenized string for the values of the keys. It would cost you another routine to pack and extract the data from the strings, but you would never have gaps in your hash table, no matter how often you delete or add something.
You could also setup your own array structures (like arrays storing other arrays or sub-arrays) by using the 's'-plugin.
Python would also allow for custom classes. You could create something like:
class Profile(object):
def __init__(self):
self.name = None
self.age = None
self.height = None
class Group(object):
def __init__(self):
self.profiles = []
def create(self):
self.profiles.append(Profile())
def delete(self, index=None):
if index == None:
del self.profiles[-1]
else:
del self.profiles[index]
def set_age(self, index=None, age=0):
if index == None:
self.profiles[-1].age = age
else:
self.profiles[index].age = age
def get_age(self, index=None):
if index == None:
return self.profiles[-1].age
else:
return self.profiles[index][/code:ep387qqo]
You would then use it this way:
[code:ep387qqo]#Your array
ProfileArray = Group()
#Create a new profile
ProfileArray.Create()
#Set the age in the newly created profile to 18
ProfileArray.set_age(None, 18)[/code:ep387qqo]
Saving the data is as simple as using file.write() after having prepared the values. (Won't go into details here, but it really isn't much effort.)
You see, there are many ways, it is up to you to decide which way to go