Wich is better in terms of speed/memory usage?
I use llParseString2List because is more generic, I can put values in csv format in a notecard and the posibility of filtering characters causes less human error prone.
These forums are CLOSED. Please visit the new forums HERE
llParseString2List or llGetSubString? |
|
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
03-31-2008 13:09
Wich is better in terms of speed/memory usage?
I use llParseString2List because is more generic, I can put values in csv format in a notecard and the posibility of filtering characters causes less human error prone. |
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
03-31-2008 15:09
GetSubString is definitely faster. But then you should work out the trade off between the robustness of llParseString2List and the index calculations required for llGetSubString. Essentially, llParseString2List is better unless you have proven performance problems with the application which may be ameliorated in a limited way by getting substrings instead.
Just my 2 cents ![]() _____________________
http://slurl.com/secondlife/Together
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
04-01-2008 10:59
Agreed. Just keep in mind that any parsing you do in your script is probably a lot faster if it can be done with a single library function call. Theoretically llParseString2List(), llParseStringKeepNulls(), and llCSV2List() only need to pass through the string once, testing each character one at a time. If LL hasn't implemented it that way, they easily could without affecting user code.
And keep in mind we'd have a tremendous boost in functionality and performance for a lot of user applications if we had some more robust parsing capability in the library. Vote and help get regular expressions added to LSL: http://jira.secondlife.com/browse/SVC-790 |
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
04-01-2008 12:14
In all my tests llParseString2List and llSubStringIndex are blazingly fast, even for abnormally large data. I wouldn't worry about whether these affect performance versus llGetSubString for simple things, but I'm actually quite sure that it's better to use the list method instead of calling llGetSubString multiple times when testing multiple cases. The only thing you need to worry about with lists is memory limitations and user input that could cause a worst-case scenario for said limitations.
_____________________
![]() |
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
04-01-2008 12:23
In all my tests llParseString2List and llSubStringIndex are blazingly fast, even for abnormally large data. I wouldn't worry about whether these affect performance versus llGetSubString for simple things, but I'm actually quite sure that it's better to use the list method instead of calling llGetSubString multiple times when testing multiple cases. The only thing you need to worry about with lists is memory limitations and user input that could cause a worst-case scenario for said limitations. I use temporary list for storing notecard lines, the list is declared inside dataserver event so it dies there. Thanks everyone for your opinions. |
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
04-01-2008 12:47
Sure, just keep in mind that even parsing a simple notecard line, if your data is evil, say, something like a bunch of commas, you could end up with a 255-length list, which will instantly take up 3336 bytes or so, and performing operations on it will bring you up to 6672 bytes used. It's always important to consider either the source of your data or how to limit overload possibilities in order to prevent crashes.
_____________________
![]() |