|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
03-30-2009 00:17
I'm making something to wear that reads data from a notecard (command, animation, offset, and a couple of other things). Is it better practice to read everything into one list and then, at runtime, say n = llListFindList(big_list,[command]); strMyAnim = llList2String(big_list, n+1); etc or to split them into separate lists when I read them at start up and look for llList2String(anim_list, n)? Or doesn't it make a lot of difference? I suppose one consideration is that -- if I properly understand it -- I have to read the offset with llList2String and then typecast it as a vector, and I will only have to do that the one time if I create separate lists.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-30-2009 05:14
if you need different type casting for different items, then yeah, it'll probably be easier to do it as it's read, saving you code later.
however if all items are a set stride length, you can actually do this as a list cleanup for a single master list, by looping through every stride-length elements and using list 2 string to read them, cast them to vector, then list replace save them back.
correcting the type at load or cleanup will add a hair of time there, but save a hair later, and over time uses less processor cycles.
the difference is only minor in which method you use, separate lists will take a small amount of memory more, but can sometime be more readable in code.
ETA: list find WILL run faster for separate lists, since it inst checking irrelevant entries, or using stride functions to search
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
03-30-2009 09:59
Thanks. I must certainly remember the list-cleanup idea; from you say, it's not really necessary for what I'm doing right now, but I do like it. Thanks, too, for confirming my gut feeling that splitting things into separate lists is a sensible way to do it. It seemed to me sensible to do as much work as possible just the one time, when I read the notecard, and then, at run-time, just figure out which item number I'm using and then look for item number n on each list. It's just that someone said, "be careful about using too many lists," so I thought I'd better check.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-30-2009 17:46
I think the 'too many lists' thing may be a holdover from before mono... LSO can be painfully slow processing list commands.
one thing I like to do is seperate my notecard reading function to it's own state... that way I can run manipulations on the data in state exit, and if I need to I can return to reading the notecard w/o wiping out other variables, plus it lets me limit user input easily while it's still reading the data.
you can do all that without a separate state, but it gets messy to look at and check which actions are ok at a given time, plus makes debugging a little easier.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|