Object deep copy test

JavaScript performance comparison

Test case created

Info

jQuery vs JSON

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script>
Benchmark.prototype.setup = function() {
    var doc = {"_type":"Dispatch Invoice Document","_id":null,"Reference Number":"11 1527/POSL1/0002NaN-102270-1","Raw Document Number":1527,"Jir":"3f6ca779-82dc-4175-82cc-fd0d0153ee86","ZastKod":"f1bcd0419823e0fcb55e6fe8441c81d7","Document Number":"1527/POSL1/0002","Cancel":"","POA":["927b623c-c604-abcd-38c0-3f8dae97fc55"],"Grace Period":"20","Previous Document Number":"","Note":"","Payment Type":["0b1af555-158f-1e5e-bb7b-8ed941a81fcd"],"Delivery Date":"27.12.2012","Document Date":"27.12.2012","Document Time":"13:04:37","Salesperson":["0051b972-7c2c-5be8-d64f-b54471d1588d"],"Latitude":"44.8659633","Longitude":"13.8486819","Time":"13:04","Items":[{"_type":"Dispatch Invoice Document Item","Item":["6bda89d5-78f8-8d20-698e-5f1b646f3441"],"Quantity":"1","Wholesale Price":"16.000","Retail Price":"20","Wholesale Total":"16","Retail Total":"20","Tax":"25.000","Discount":"0","_id":"980fcb2d-7314-44a1-aa84-9304bf4fc304"},{"_type":"Dispatch Invoice Document Item","Item":["f3d23041-49c7-af32-6eec-347bcc5854b2"],"Quantity":"1","Wholesale Price":"60.750","Retail Price":"75.9375","Wholesale Total":"60.75","Retail Total":"75.9375","Tax":"25.000","Discount":"0","_id":"6ca74dc2-d0df-4bcf-a980-95c935887f39"},{"_type":"Dispatch Invoice Document Item","Item":["d04b11ab-3a2c-f6df-d79b-6364c5673d21"],"Quantity":"1","Wholesale Price":"81.280","Retail Price":"101.6","Wholesale Total":"81.28","Retail Total":"101.6","Tax":"25.000","Discount":"0","_id":"39c68457-4b10-4757-91fc-a7cb58c29230"},{"_type":"Dispatch Invoice Document Item","Item":["7b6747a7-7b0f-7192-7d74-4f47c6630067"],"Quantity":"1","Wholesale Price":"20.000","Retail Price":"25","Wholesale Total":"20","Retail Total":"25","Tax":"25.000","Discount":"0","_id":"6f452f75-0030-4809-94fe-0149761a85a7"},{"_type":"Dispatch Invoice Document Item","Item":["62804bb0-5cca-3fbd-97fd-97ba9ec924d4"],"Quantity":"1","Wholesale Price":"40.000","Retail Price":"50","Wholesale Total":"40","Retail Total":"50","Tax":"25.000","Discount":"0","_id":"cbf71e94-0a05-4402-aa96-935de4541277"},{"_type":"Dispatch Invoice Document Item","Item":["57d27580-46c4-8d93-bd56-e8196b2ad964"],"Quantity":"1","Wholesale Price":"20.000","Retail Price":"25","Wholesale Total":"20","Retail Total":"25","Tax":"25.000","Discount":"0","_id":"f57d87d7-a6aa-45c3-8d95-4c5fff05e755"},{"_type":"Dispatch Invoice Document Item","Item":["eafc5c4c-8901-a7eb-572e-0d2b36e68a57"],"Quantity":"1","Wholesale Price":"12.000","Retail Price":"15","Wholesale Total":"12","Retail Total":"15","Tax":"25.000","Discount":"0","_id":"94a78108-f0ab-4326-9a95-02dd2389d548"},{"_type":"Dispatch Invoice Document Item","Item":["9f3956e7-22b2-1e00-54ed-3e1a4f0c3ca2"],"Quantity":"1","Wholesale Price":"24.000","Retail Price":"30","Wholesale Total":"24","Retail Total":"30","Tax":"25.000","Discount":"0","_id":"11338bc5-0b6a-4763-acb2-c1b16414707a"},{"_type":"Dispatch Invoice Document Item","Item":["55531a39-12e4-63bc-59b8-065eb05b4e9c"],"Quantity":"1","Wholesale Price":"16.000","Retail Price":"20","Wholesale Total":"16","Retail Total":"20","Tax":"25.000","Discount":"0","_id":"5632a9bf-7d5a-4019-8259-2518dc3028c0"},{"_type":"Dispatch Invoice Document Item","Item":["2a3342d5-2107-7751-6f77-68d705f16a11"],"Quantity":"1","Wholesale Price":"40.000","Retail Price":"50","Wholesale Total":"40","Retail Total":"50","Tax":"25.000","Discount":"0","_id":"acb83b5e-1014-4347-baf2-9e83eb0fc09e"},{"_type":"Dispatch Invoice Document Item","Item":["29bb4029-8f1d-bba3-a7b4-0686761e7179"],"Quantity":"1","Wholesale Price":"20.000","Retail Price":"25","Wholesale Total":"20","Retail Total":"25","Tax":"25.000","Discount":"0","_id":"7851eca9-07bd-44ac-a48a-c9819313f096"},{"_type":"Dispatch Invoice Document Item","Item":["35a6970b-6bc0-1991-18b8-3499b1ed38fa"],"Quantity":"1","Wholesale Price":"80.000","Retail Price":"100","Wholesale Total":"80","Retail Total":"100","Tax":"25.000","Discount":"0","_id":"d6c0cdd4-add1-4d40-856d-57d77a097ebe"},{"_type":"Dispatch Invoice Document Item","Item":["087aa8e1-f0c1-9fbd-6dc2-8fc0d6f43fa5"],"Quantity":"1","Wholesale Price":"40.650","Retail Price":"50.8125","Wholesale Total":"40.65","Retail Total":"50.8125","Tax":"25.000","Discount":"0","_id":"8bb81678-7759-4c20-a5a5-11f64e8e20dc"},{"_type":"Dispatch Invoice Document Item","Item":["4cf90198-23bb-1fc8-799c-d88293aced03"],"Quantity":"1","Wholesale Price":"20.000","Retail Price":"25","Wholesale Total":"20","Retail Total":"25","Tax":"25.000","Discount":"0","_id":"e18174d8-53f9-4d74-bcd5-af599552fbf7"},{"_type":"Dispatch Invoice Document Item","Item":["ab1fb9af-aa86-476a-c9d3-231fc3639df7"],"Quantity":"1","Wholesale Price":"81.300","Retail Price":"101.625","Wholesale Total":"81.3","Retail Total":"101.625","Tax":"25.000","Discount":"0","_id":"ee348362-73c6-4e5f-be1f-774880f01cb9"},{"_type":"Dispatch Invoice Document Item","Item":["d94a506c-3ce0-372e-050c-8b3b9cf55a61"],"Quantity":"1","Wholesale Price":"40.000","Retail Price":"50","Wholesale Total":"40","Retail Total":"50","Tax":"25.000","Discount":"0","_id":"026ab8c6-732c-4b30-ad4f-1c3a5aa7d98a"},{"_type":"Dispatch Invoice Document Item","Item":["56f5d82c-c5ac-c1c8-5faa-0a16a5528146"],"Quantity":"1","Wholesale Price":"159.200","Retail Price":"199","Wholesale Total":"159.2","Retail Total":"199","Tax":"25.000","Discount":"0","_id":"f70b359c-1a01-4fe4-9967-6d658d655b1d"},{"_type":"Dispatch Invoice Document Item","Item":["1038d5bc-692e-5500-6bcc-519d0db429ca"],"Quantity":"1","Wholesale Price":"17.600","Retail Price":"22","Wholesale Total":"17.6","Retail Total":"22","Tax":"25.000","Discount":"0","_id":"b4807353-f9a0-4caa-836e-4727decb922f"}],"Nr Items":"18","Wholesale Total":"788.78","Retail Total":"985.98"}
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jQuery extend
var b = $.extend(true, {}, doc);
pending…
JSON parser
var b = JSON.parse(JSON.stringify(doc));
pending…
Eval
eval("doc = " + JSON.stringify(doc))
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment