Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

speed - lists2string VS substring

Mark Busch
DarkLife Developer
Join date: 8 Apr 2003
Posts: 442
11-05-2004 07:06
If you want to transfer data from one object to the other (like lists) is it faster to use concatenation without spacers (like a ',' ) and use llGetsubstring to get the data
or concatenate with ',' use string2list to make it a list, and substract the data from that list.
anyone tested this?
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
11-05-2004 07:38
I would guess, without testing, that the substring would be faster... BUT it would require your elements to be of fixed length. Might be worth it to do some tests, it should be easy enough.

If substrings are sigificantly faster, you could work out a way to use that method with variable-length elements. Just add a 2-digit length integer. Read the length, scan than many characters into a variable, read the next length, scan THAT many, etc. You could even use base64 packing to store more info in the 2-character length field, such as type information.

Personally, I use llCSV2List then access the list elements.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Mark Busch
DarkLife Developer
Join date: 8 Apr 2003
Posts: 442
11-05-2004 07:47
yeah I guess I will make a little test as soon as possible and post the restults here :D
I use substring now and I usually put some zeros in front of numbers to make it a fixed length... because I thought it would be faster..
but I figured I haven't tested it yet so it might be even slower :S one thing that is sure that it is more tricky to do... you almost always make mistake in the values you need to pass to llGetSubString()
anyway gonna test soon :) can't be bad.. if list2string is not faster then I don't need to change anything, if it IS faster then I have found a big speedup for my scripts :P
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
11-05-2004 12:23
If you are looking for answers with metrics, then this AINT it. I do not have any numbers recorded on the differences between the string compares and the link compares, but the link compares use more script memory, and are slower, but also easier to code. The string compares need to use a little trickier code, in the long run you have to decide if you are going to have a lot of the comparison done. Possibly what you can do is write these particular comparisons in functions and judge for yourself what the metrics are. Look at the difference in how much memory is used, and set a variable with the time so you can see the difference in time. Probably the larger the project gets, the slower the lists will be. The next step is to use an XML-RPC database method, and that's where you lose me altogether! =)
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts