Skip to content

Commit

Permalink
feat: add serverStartAndLoadPageTime4Code and serverStartAndLoadPageT…
Browse files Browse the repository at this point in the history
…ime4Hot

 index
  • Loading branch information
ruleeeer committed Mar 25, 2024
1 parent c0e75e3 commit f8beaca
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/tools/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ async function start() {
loadPageTime4Cold,
serverStartTime4Hot: serverStartTime4Hot ?? "skipped",
loadPageTime4Hot: loadPageTime4Hot ?? "skipped",
serverStartAndLoadPageTime4Code: addFormatOutput(
serverStartTime4Cold,
loadPageTime4Cold,
),
serverStartAndLoadPageTime4Hot: addFormatOutput(
serverStartTime4Hot,
loadPageTime4Hot,
),
rootHmrTime,
leafHmrTime,
buildTime,
Expand All @@ -90,6 +98,20 @@ async function start() {
console.table(results);
}

function addFormatOutput(...args) {
console.log(args);
let val = 0;
for (const arg of args) {
if (!arg || arg === "skipped" || arg === -1) {
console.log("skipped");
return "skipped";
}
val += arg;
}
console.log(val);
return val;
}

function printResult() {
const result = Object.fromEntries(
Object.entries(totalResult).map(([k, v]) => [
Expand Down

0 comments on commit f8beaca

Please sign in to comment.