mirror of https://github.com/webpack/webpack.git
test: debug
This commit is contained in:
parent
a570a65384
commit
81a41850e0
|
@ -489,6 +489,59 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
return result;
|
||||
};
|
||||
|
||||
function printStatus(fn) {
|
||||
const status = eval("%GetOptimizationStatus(fn)");
|
||||
console.log(status.toString(2).padStart(12, "0"));
|
||||
|
||||
if (status & (1 << 0)) {
|
||||
console.log("is function");
|
||||
}
|
||||
|
||||
if (status & (1 << 1)) {
|
||||
console.log("is never optimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 2)) {
|
||||
console.log("is always optimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 3)) {
|
||||
console.log("is maybe deoptimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 4)) {
|
||||
console.log("is optimized");
|
||||
}
|
||||
|
||||
if (status & (1 << 5)) {
|
||||
console.log("is optimized by TurboFan");
|
||||
}
|
||||
|
||||
if (status & (1 << 6)) {
|
||||
console.log("is interpreted");
|
||||
}
|
||||
|
||||
if (status & (1 << 7)) {
|
||||
console.log("is marked for optimization");
|
||||
}
|
||||
|
||||
if (status & (1 << 8)) {
|
||||
console.log("is marked for concurrent optimization");
|
||||
}
|
||||
|
||||
if (status & (1 << 9)) {
|
||||
console.log("is optimizing concurrently");
|
||||
}
|
||||
|
||||
if (status & (1 << 10)) {
|
||||
console.log("is executing");
|
||||
}
|
||||
|
||||
if (status & (1 << 11)) {
|
||||
console.log("topmost frame is turbo fanned");
|
||||
}
|
||||
}
|
||||
|
||||
const runTaskAsync = async (task, uri) => {
|
||||
const { fnOpts, fn } = task;
|
||||
|
||||
|
@ -503,11 +556,15 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
samples.push(await iterationAsync(task));
|
||||
}
|
||||
|
||||
await optimizeFunction(async () => {
|
||||
const toRun = async () => {
|
||||
await fnOpts?.beforeEach?.call(task, "run");
|
||||
await fn();
|
||||
await fnOpts?.afterEach?.call(task, "run");
|
||||
});
|
||||
};
|
||||
|
||||
await optimizeFunction(toRun);
|
||||
|
||||
console.log("optimize", printStatus(toRun));
|
||||
|
||||
await fnOpts?.beforeEach?.call(task, "run");
|
||||
await mongoMeasurement.start(uri);
|
||||
|
@ -604,7 +661,7 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
return finalizeSyncRun();
|
||||
};
|
||||
} else if (codspeedRunnerMode === "walltime") {
|
||||
// TODO
|
||||
// We don't need it
|
||||
}
|
||||
|
||||
return bench;
|
||||
|
|
Loading…
Reference in New Issue