jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<script src="https://cdn.jsdelivr.net/msgpack/1.05/msgpack.base.js"></script>
<script>
var json = [{
PartnerID : 1
, APIKey : '4f92cd9422044bd6b68f20994cad8bc8'
, SubsystemId : 0
, HttpVerbTypeID : 1
, HttpStatus : 200
, RequestDatetime : '2014-05-15 19:41:27.016'
, PageURL : 'http://www.justanswer.com/law/8g93i-options-someone-used-sealed-court-documents.html'
, ReferralURL : 'http://www.justanswer.com/law/'
, RequestGUID : 'd3144881-8c96-4bb5-b055-68b560fb9436'
, OriginatingRequestGUID : ''
, RouteAction : 'page/unknown'
, RouteActionGUID : '214a4f03-95b7-4895-9140-6eb55741cc24'
, VisitorGUID : '3e7c3ea7-2a9a-4a51-d760-8f72a8714730'
, ApiEncodedUserID : 'd2bc0a1283334374b6da7be4fe31f7ab'
, CookiesEnabled : true
}];
var StaticJSONP = {
notify: function(uid, dummyData) {
window.dummyData = json;
}
};
var JsonFormatter = {
stringify: function (cipherParams) {
// create json object with ciphertext
var jsonObj = {
ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64)
};
// optionally add iv and salt
if (cipherParams.iv) {
jsonObj.iv = cipherParams.iv.toString();
}
if (cipherParams.salt) {
jsonObj.s = cipherParams.salt.toString();
}
// stringify json object
return JSON.stringify(jsonObj);
},
parse: function (jsonStr) {
// parse json string
var jsonObj = JSON.parse(jsonStr);
// extract ciphertext from json object, and create cipher params object
var cipherParams = CryptoJS.lib.CipherParams.create({
ciphertext: CryptoJS.enc.Base64.parse(jsonObj.ct)
});
// optionally extract iv and salt
if (jsonObj.iv) {
cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv)
}
if (jsonObj.s) {
cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s)
}
return cipherParams;
}
};
"JSON" in this || document.write('<','script src="http://www.3site.eu/examples/json.hpack/test/json2.js">','<','/script>');
document.write([
'<','script src="http://www.3site.eu/examples/json.hpack/test/dummy.js">','<','/script>',
'<','script src="http://www.3site.eu/examples/json.hpack/test/JSONH.js">','<','/script>','<','script src="http://www.javascriptoo.com/application/html/js/tcorral/jsonc/jsonc.js">','<','/script>',
'<','script src="http://www.3site.eu/examples/json.hpack/test/JSONHF.js">','<','/script>'
,
'<','script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/core-min.js">','<','/script>'
,
'<','script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-utf16-min.js">','<','/script>'
,
'<','script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js">','<','/script>'
,
'<','script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js">','<','/script>'
].join(""));
</script>
if( typeof(Base64result)!='undefined' && typeof(done)=='undefined'){
n="JSONHresult";
console.log(n,window[n],window[n].length);
n="JSONresult";
console.log(n,window[n],window[n].length);
n="msgpackresult";
console.log(n,window[n],window[n].length);
n="JSONCresult";
console.log(n,window[n],window[n].length);
n="JSONAESresult";
console.log(n,window[n],window[n].length);
n="Base64result";
console.log(n,window[n],window[n].length);
message = window.JSONCresult;
words = CryptoJS.enc.Utf16.parse(message);
window.Base64result=CryptoJS.enc.Base64.stringify(words);console.log('JSONC+Base64 encode',window.Base64result,window.Base64result.length);
message = window.JSONCresult;
words = CryptoJS.enc.Base64.parse(window.Base64result);
window.Base64result=CryptoJS.enc.Utf16.stringify(words);console.log('JSONC+Base64 decode',window.Base64result,window.Base64result.length);
done = true;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
JSON.stringify |
| ready |
JSONH.stringify |
| ready |
msgpack.pack |
| ready |
JSON.parse |
| ready |
JSONH.parse |
| ready |
msgpack.unpack |
| ready |
JSONC.pack |
| ready |
JSONC.unpack |
| ready |
CryptoJS.AES.encrypt |
| ready |
Base64.stringify |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.