Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Efficient List Handling Question

Sharp Pike
Registered User
Join date: 24 Oct 2006
Posts: 12
08-07-2007 10:39
Trying to make some of my list processing as efficient as possible and wondering what the trade-offs are of the two options below. I assume that the second option is faster but more memory intensive while the first is slower?

string oldvisitor = llList2String(current, x);
integer left = llListFindList(curvisitors, [oldvisitor]);

or

list oldvisitor = llList2List(current, x,x);
integer left = llListFindList(curvisitors, oldvisitor);
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
08-07-2007 22:23
both are probably about the same speed, the second uses more memory because of the 2nd list
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
08-08-2007 03:51
If you're not gonna use oldvisitor anywhere else, combine it into 1 command:

integer left = llListFindList(curvisitors, llList2List(current, x,x));

That saves memory for not using an extra variable.

Purely intuitively, I suspect using llList2List is better than [llList2String]. In the latter, you're converting part of a list to a string, and back to a list. That conversion must be using some processing (allthough it won't be a lot).
Sharp Pike
Registered User
Join date: 24 Oct 2006
Posts: 12
08-09-2007 07:53
Thanks Lyn and Os. Since I only use the oldvisitor variable in 2 places I'll replace it with the LLList2List function call in both place and save the memory. Thanks again for the advice.