Performance Test: Phlox vs Mono
I was doing some performance tests with some of my code, by measuring how long it takes different methods to complete a particular task a few thousand times.
Now, LSL has more performance constraints than most programming languages, since it is compiled to bytecode and run in a VM.
I had written a bit of code to see if a particular character in a string was a valid hexadecimal digit, as part of a function to check and see if an input string was a valid UUID key, and wrote a lazy method for it. Then I decided to see if a more complex method would run faster:
Lazy Method:
Calls llSubStringIndex, which iterates over the input string ‘test’ and reports the index number of the first instance of the string ‘s’ that it finds.
if(llSubStringIndex(test,s) == -1)
Ugly Method:
A bunch of OR’ed comparisons, put inside of a ( ) with a ! preceding it to reverse the result to false.
if(!(s==”0” || s==”1” || s==”2” || s==”3” || s==”4” || s==”5” || s==”6” || s==”7” || s==”8” || s==”9” || s==”a” || s==”b” || s==”c” || s==”d” || s==”e” || s==”f”))
- Lazy Method: 2.89 seconds
- Ugly Method: 6.65 seconds
- Lazy Method: 104.43 seconds (1 minute, 44 seconds)
- Ugly Method: 118.61 seconds (1 minute, 58 seconds)
- Method A: 0.167 seconds
- Method B: 2.442 seconds
- Method A: 7.45 seconds
- Method B: 94.03 seconds (1 minute, 34 seconds)
And I hope they do so, because it would go a long ways towards improving Second Life. I won’t hold my breath, though.
2 Notes/ Hide
-
sorornishi likes this
-
sorornishi reblogged this from zauberparacelsus
-
zauberparacelsus posted this