JSON.parse versus angular.fromJson

Benchmark created by Orestis Ioakeimidis on


Description

Compare the performance between JSON.parse method and angular.fromJson method. Both are used to deserialize a JSON string.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>

Setup

var string = '{"text": "100", "modifiers": "notification, success", "some": "else", "test": "value", "text": "100", "modifiers": "notification, success", "some": "else", "test": "value", "text": "100", "modifiers": "notification, success", "some": "else", "test": "value", "text": "100", "modifiers": "notification, success", "some": "else", "test": "value", "text": "100", "modifiers": "notification, success", "some": "else", "test": "value", "text": "100", "modifiers": "notification, success", "some": "else", "test": "value", "text": "100", "modifiers": "notification, success", "some": "else", "test": "value"}';

Test runner

Ready to run.

Testing in
TestOps/sec
JSON.parse
var result = JSON.parse(string);
ready
angular.fromJson
var result = angular.fromJson(string);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.