mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1593728 Part 1: [devtools] Rename parameter in a test to avoid using the async keyword. r=perftest-reviewers,nchevobbe,sparky
This is just cleanup to avoid the "async" keyword as an identifier, plus using const where appropriate. Differential Revision: https://phabricator.services.mozilla.com/D93431
This commit is contained in:
parent
db1c8d8a34
commit
bc49180432
@ -8,16 +8,16 @@
|
|||||||
<script>
|
<script>
|
||||||
// These query parameters are set in damp.js:customConsole and define the number
|
// These query parameters are set in damp.js:customConsole and define the number
|
||||||
// of console API calls we do in this test.
|
// of console API calls we do in this test.
|
||||||
let searchParams = new URLSearchParams(location.search);
|
const searchParams = new URLSearchParams(location.search);
|
||||||
let sync = searchParams.get("sync");
|
const sync = searchParams.get("sync");
|
||||||
let stream = searchParams.get("stream");
|
const stream = searchParams.get("stream");
|
||||||
let async = searchParams.get("async");
|
const batch = searchParams.get("batch");
|
||||||
|
|
||||||
// We log complex objects:
|
// We log complex objects:
|
||||||
// * a complex js object (window)
|
// * a complex js object (window)
|
||||||
// * a DOM node (body)
|
// * a DOM node (body)
|
||||||
// * a large array
|
// * a large array
|
||||||
let bigArray = Array.from({length: 10000}, (_, i) => i);
|
const bigArray = Array.from({length: 10000}, (_, i) => i);
|
||||||
|
|
||||||
// Fill up the console with many logs synchronously during page load.
|
// Fill up the console with many logs synchronously during page load.
|
||||||
for (let i = 0; i < sync; i++) {
|
for (let i = 0; i < sync; i++) {
|
||||||
@ -31,20 +31,20 @@ function streamLogs() {
|
|||||||
if (n < stream) {
|
if (n < stream) {
|
||||||
requestAnimationFrame(streamLogs);
|
requestAnimationFrame(streamLogs);
|
||||||
} else {
|
} else {
|
||||||
requestIdleCallback(asyncLogs);
|
requestIdleCallback(batchLogs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
requestIdleCallback(streamLogs);
|
requestIdleCallback(streamLogs);
|
||||||
|
|
||||||
// Finally, we log by small bulk asynchronously slightly more slowly thanks to idle callback
|
// Finally, we batch log by small bulk asynchronously slightly more slowly thanks to idle callback
|
||||||
let x = 0;
|
let x = 0;
|
||||||
function asyncLogs() {
|
function batchLogs() {
|
||||||
let asyncBulk = 10;
|
const batchSize = 10;
|
||||||
for (let i = 0; i < asyncBulk; i++) {
|
for (let i = 0; i < batchSize; i++) {
|
||||||
console.log("async log", x++, window, document.body, bigArray);
|
console.log("batch log", x++, window, document.body, bigArray);
|
||||||
}
|
}
|
||||||
if (x < async) {
|
if (x < batch) {
|
||||||
requestIdleCallback(asyncLogs);
|
requestIdleCallback(batchLogs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -17,15 +17,15 @@ const TEST_URL = PAGES_BASE_URL + "custom/console/index.html";
|
|||||||
|
|
||||||
module.exports = async function() {
|
module.exports = async function() {
|
||||||
// These numbers controls the number of console api calls we do in the test
|
// These numbers controls the number of console api calls we do in the test
|
||||||
let sync = 250,
|
const sync = 250,
|
||||||
stream = 250,
|
stream = 250,
|
||||||
async = 250;
|
batch = 250;
|
||||||
let params = `?sync=${sync}&stream=${stream}&async=${async}`;
|
const params = `?sync=${sync}&stream=${stream}&batch=${batch}`;
|
||||||
let url = TEST_URL + params;
|
const url = TEST_URL + params;
|
||||||
await testSetup(url, { disableCache: true });
|
await testSetup(url, { disableCache: true });
|
||||||
|
|
||||||
let toolbox = await openToolboxAndLog("custom.webconsole", "webconsole");
|
const toolbox = await openToolboxAndLog("custom.webconsole", "webconsole");
|
||||||
await reloadConsoleAndLog("custom", toolbox, sync + stream + async);
|
await reloadConsoleAndLog("custom", toolbox, sync + stream + batch);
|
||||||
await closeToolboxAndLog("custom.webconsole", toolbox);
|
await closeToolboxAndLog("custom.webconsole", toolbox);
|
||||||
|
|
||||||
await testTeardown();
|
await testTeardown();
|
||||||
|
Loading…
Reference in New Issue
Block a user