Optimizations to [AV]faces.
Optimize IsInteger, optimize data memory usage through list item reuse, remove redundant statement. See http://lsl.project.zone/lsl/types/list#data_memory_usage for more information on reusing of list elements. See https://gist.github.com/Sei-Lisa/2250e59040a4d10c4b28998ac045fb7d for a demonstration of the mechanism as used in this patch.
This commit is contained in:
parent
37d39193c1
commit
7a48f16349
1 changed files with 7 additions and 4 deletions
|
@ -37,7 +37,8 @@ list facial_anim_list =
|
||||||
|
|
||||||
integer IsInteger(string data)
|
integer IsInteger(string data)
|
||||||
{
|
{
|
||||||
return llParseString2List((string)llParseString2List(data, ["8", "9"], []), ["0", "1", "2", "3", "4", "5", "6", "7"], []) == [] && data != "";
|
// This should allow for leading zeros, hence the "1"
|
||||||
|
return data != "" && (string)((integer)("1" + data)) == "1" + data;
|
||||||
}
|
}
|
||||||
|
|
||||||
string version = "2.2";
|
string version = "2.2";
|
||||||
|
@ -197,9 +198,8 @@ sequence()
|
||||||
remove_sequences(key id)
|
remove_sequences(key id)
|
||||||
{
|
{
|
||||||
integer index;
|
integer index;
|
||||||
while (~llListFindList(running_uuid, [id]))
|
while (~(index = llListFindList(running_uuid, [id])))
|
||||||
{
|
{
|
||||||
index = llListFindList(running_uuid, [id]);
|
|
||||||
running_uuid = llDeleteSubList(running_uuid, index, index);
|
running_uuid = llDeleteSubList(running_uuid, index, index);
|
||||||
list sequence = llParseStringKeepNulls(llList2String(anim_animsequences, llList2Integer(running_sequence_indexes, index)), ["|"], []);
|
list sequence = llParseStringKeepNulls(llList2String(anim_animsequences, llList2Integer(running_sequence_indexes, index)), ["|"], []);
|
||||||
running_sequence_indexes = llDeleteSubList(running_sequence_indexes, index, index);
|
running_sequence_indexes = llDeleteSubList(running_sequence_indexes, index, index);
|
||||||
|
@ -416,7 +416,10 @@ default
|
||||||
integer index = llListFindList(facial_anim_list, [llList2String(sequence, x)]);
|
integer index = llListFindList(facial_anim_list, [llList2String(sequence, x)]);
|
||||||
if (~index)
|
if (~index)
|
||||||
{
|
{
|
||||||
sequence = llListReplaceList(sequence, [index], x, x);
|
// Reuse the string in facial_anim_list to save memory
|
||||||
|
sequence = llListReplaceList(sequence,
|
||||||
|
llList2List(facial_anim_list, index, index), // OSS::[index],
|
||||||
|
x, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
anim_triggers += [(string)notecard_section + "|" + part0];
|
anim_triggers += [(string)notecard_section + "|" + part0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue