Skip to content
Permalink
Browse files

Really fix benchmarking on iOS.

JavaScriptCore has a JSONP detector (WebKit/webkit@cef0b13)
that was making the JS path give identical performance to the inert one.
  • Loading branch information...
mihaip committed Jan 7, 2018
1 parent e735d34 commit bdb1c91de4667f5bccee098e7876e88150e97096
Showing with 5 additions and 1 deletion.
  1. +5 −1 inline-json/script.js
@@ -2,7 +2,7 @@ const MAX_ARRAY_SIZE = 13;

document.querySelector("#test").onclick = e => {
const jsonString = JSON.stringify(generateJsonData());
const jsHtml = `<script>handleData(${jsonString});</script>`;
const jsHtml = `<script>handleData(${jsonString});noop();</script>`;
const inertHtml = `
<script type="application/json">${jsonString}</script>
<script>
@@ -118,6 +118,10 @@ function runTest(testHtml, callback) {
parseTime: performance.now() - startTime
}, "*");
}
function noop() {
// Dummy function to also call so that JavaScriptCore's JSONP
// detection doesn't kick in.
}
</script>
${testHtml.replace('"DATE_PLACEHOLDER"', Date.now())}
</head>

0 comments on commit bdb1c91

Please sign in to comment.
You can’t perform that action at this time.