Hey everyone!
I'm working on a new script that will potentially require storing large-ish amounts of data in a nested array that I want to persist between sessions:
I'll be looping through to add Items at various points within the array as well as looping through and logging specific items in a chat message.
I don't want to inadvertently create a performance nightmare and bog down the campaign's API and am hoping some of you might know or have some thoughts off-hand.
Question 1: At was size does looping through an array and checking a few conditions begin to affect performance? And if my arrays are in that range is jumping to a midpoint then choosing a half until I get to a manageable size to loop through a good work around?
Question 2: Would storing this array in a key inside the state object be preferable to (or worse than?) storing the array inside a character attribute and parsing it in and out?
For my own personal use of the script I don't anticipate it getting too dense but I want to make it robust enough that it won't crash someone else's campaign if they are using it more intensely (or warn them of it's limitations!).
Thanks!
I'm working on a new script that will potentially require storing large-ish amounts of data in a nested array that I want to persist between sessions:
[[Item1,data,data,data],[Item2,data,data,data],[Item3,data,data,data],...]
I'll be looping through to add Items at various points within the array as well as looping through and logging specific items in a chat message.
I don't want to inadvertently create a performance nightmare and bog down the campaign's API and am hoping some of you might know or have some thoughts off-hand.
Question 1: At was size does looping through an array and checking a few conditions begin to affect performance? And if my arrays are in that range is jumping to a midpoint then choosing a half until I get to a manageable size to loop through a good work around?
Question 2: Would storing this array in a key inside the state object be preferable to (or worse than?) storing the array inside a character attribute and parsing it in and out?
For my own personal use of the script I don't anticipate it getting too dense but I want to make it robust enough that it won't crash someone else's campaign if they are using it more intensely (or warn them of it's limitations!).
Thanks!