<!--your preparation HTML code goes here-->
/*your preparation JavaScript code goes here
To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/
async function globalMeasureThatScriptPrepareFunction() {
// This function is optional, feel free to remove it.
// await someThing();
}
JSON.stringify({
"results": [
{
"gender": "female",
"name": {
"title": "Miss",
"first": "Jennie",
"last": "Nichols"
},
"picture": {
"large": "https://randomuser.me/api/portraits/men/75.jpg",
"medium": "https://randomuser.me/api/portraits/med/men/75.jpg",
"thumbnail": "https://randomuser.me/api/portraits/thumb/men/75.jpg"
},
"nat": "US"
}
],
"info": {
"seed": "56d27f4a53bd5441",
"results": 1,
"page": 1,
"version": "1.4"
}
})
var tmp = 1+1
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
slow | |
quick |
Test name | Executions per second |
---|---|
slow | 2250461.8 Ops/sec |
quick | 214726112.0 Ops/sec |
The benchmark defined by MeasureThat.net focuses on evaluating the performance of two different types of JavaScript operations: the execution time of a basic arithmetic operation and the serialization of a JavaScript object into a JSON string.
Test Name: "quick"
var tmp = 1 + 1
Test Name: "slow"
JSON.stringify({...})
+
operator for arithmetic and the JSON.stringify
method for object serialization. JSON
object, which is part of the ECMAScript standard. The primary purpose of JSON.stringify()
is to convert data structures into a format that can be easily transmitted or stored, such as in web applications or APIs..map()
or .reduce()
), asynchronous operations, or DOM manipulations.In summary, the benchmark assesses the performance of two operations: a quick arithmetic operation against the more complex JSON.stringify()
, reflecting the efficient handling of simple versus nested data structures in JavaScript. This comparative approach helps developers identify performance characteristics and potential bottlenecks when designing applications that utilize JavaScript for data processing.