Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: ScriptItem performance

0
0
Ok I did some more benchmarking and I did the following, where rec is a flat json object.
var arr = [rec, rec, rec];
    var strJson = JSON.stringify(arr);
    new MiTable("form", arr);
    new MiTable("form", strJson);


    startTime();
    for (var i = 0; i < 1000; i++)
        new MiTable("form", strJson);
    stopTime();

    startTime();
    for (var i = 0; i < 1000; i++)
        new MiTable("form", arr);
    stopTime();
Both the strJson and the JSON function implement the same idea, but the strJson de-serialises the string, and still managed to be faster.
My point stays, isn't it better to not make ScriptItem dynamic. Because within Javascript all object can be of fixed types and all objects are key value pairs anyway. Or maybe is it possible to make use of JSON.net JObject instead of dynamic ScriptItem? Even translating the ScriptItem to JObject results in a higher benchmark than the above benchmark.

Anyway, thanks for your time and I hope you can do something with my findings.

Viewing all articles
Browse latest Browse all 2297