Thermal Update Script C#light,ulua,scorpio performance comparison

Source: Internet
Author: User

Http://www.unity Bull. com/thread-32861-1-1.html

Test environment: unity4.5.2 Three scripts are all source code import PC: Processor Intel (R) Core (TM) i5-3470 CPU @ 3.20GHz 3.60GHz Memory: 8.00GB system: Windows 7 64 bit first paste the source code : (Note: The CLS author says that the CLS script scope is quite strong, so using the for loop inside the script might be a bit lossy. CLS Test results more Test results please download the source code self-test)
Stopwatch watch = null;
{
Watch = Stopwatch.startnew ();
Script env = new script ();
Env. LoadLibrary ();
Env. Pushassembly (typeof (Gameobject). Assembly);
var token = env. LoadString (M_scorpio);
M_scorpioruntime = string. Format ("Scorpio time: {0} ms return value: {1}", watch. Elapsedmilliseconds, token);
}
{
Watch = Stopwatch.startnew ();
Luastate env = new Luastate ();
var token = env. Dostring (M_lua);
M_luaruntime = string. Format ("Lua time: {0} ms return value: {1}", watch. Elapsedmilliseconds, token! = null && token. Length > 0? TOKEN[0]: "null");
}
{
Cls_environment env = new Cls_environment (new Scriptlogger ());
Env. Regtype (New Reghelper_type (typeof (Gameobject)));
var token = env. Parsertoken (M_CLS);
var expr = env. Expr_compilertoken (token, false);
Watch = Stopwatch.startnew ();
var value = env. Expr_execute (expr, null);
M_clsruntime = string. Format ("CLS time-consuming: {0} ms return value: {1} (because it is heard that CLS parsing is slow and only calculates expr_execute time)", watch. Elapsedmilliseconds, value);
}
Test1: Test Script self-op efficiency (test result: Lua's self-computing power is the fastest, after all, the bottom of C implementation and the world's fastest scripting engine)
<ignore_js_op>

TEST2: Test calls to C # functions and the efficiency of creating objects (test Result: Ulua The C # function is called after all to serialize the object to a table call, so it takes time. SCO and CLS are directly called reflection or fast reflection class of non-serialized process So you can compensate for some of the loss of the self-operation)

<ignore_js_op>

TEST3: Testing the efficiency of calling C # deep variables (test result: Ulua There's no imaginary drop on a deep call. There should be a cache for serialization of a type)
<ignore_js_op>



Results:
Ulua in the case of more self-operation is still very dominant, after all, is the bottom of the C language and well-known Lua people many forums, tutorials are many in the introductory aspect or very dominant
The disadvantage is that the bug is more troublesome, and out of the bug is mostly memory will cause the application directly crash bug tracking platform support Windows,android,ios does not support WP if you want to do WP version estimated to take a kung fu
CLS syntax and C # advantage is obvious if you are afraid of a piece of code efficiency or relatively stable code can be directly into the C # efficiency immediately restored and do not worry about the bug and the C # language write the problem can also be quickly located (Platform support Windows,andoird, IOS,WP, etc. to publish other platform is relatively convenient)
Disadvantage efficiency seems to be a problem
SCO test results Efficiency is also OK, the source project is relatively small, DLL support 72K source code is easy to understand a bit of work experience has a half-day should be able to read and is C # language written out of the problem can also be quickly located (platform support WINDOWS,ANDOIRD,IOS,WP, etc. to publish other platforms or More convenient)
The disadvantage syntax is similar to JavaScript and there are some grammatical different languages based on fewer people


Summary: Each of the three kinds of scripts have their own advantages, after all, just script, do not care about efficiency, and no one to script a game, just to do some configuration and UI operations, these code three kinds of script efficiency is harmless
The key in personal preferences! Dynamic scripting and static scripting each have their own benefits!


Finally on the test source: Https://github.com/qingfeng346/ScriptTestor
Scorpio-csharp Source Address: Https://github.com/qingfeng346/Scorpio-CSharp
QQ Group discussion: 245199668

Thermal Update Script C#light,ulua,scorpio performance comparison

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.