mirror of https://github.com/webpack/webpack.git
Compare commits
4 Commits
baa03b55f3
...
c48d17240f
Author | SHA1 | Date |
---|---|---|
|
c48d17240f | |
|
7634cd28bf | |
|
f95bc4e7b4 | |
|
0f668bd546 |
|
@ -103,6 +103,7 @@ jobs:
|
|||
mode: "instrumentation"
|
||||
token: ${{ secrets.CODSPEED_TOKEN }}
|
||||
env:
|
||||
CODSPEED_DEBUG: 1
|
||||
LAST_COMMIT: 1
|
||||
NEGATIVE_FILTER: on-schedule
|
||||
SHARD: ${{ matrix.shard }}
|
||||
|
|
|
@ -300,7 +300,7 @@ module.exports = __webpack_require__.tb("PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmc
|
|||
/******/
|
||||
/******/ /* webpack/runtime/jsonp chunk loading */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.b = (document && document.baseURI) || self.location.href;
|
||||
/******/ __webpack_require__.b = (typeof document !== 'undefined' && document.baseURI) || self.location.href;
|
||||
/******/
|
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
|
@ -476,10 +476,10 @@ files.forEach(item => {
|
|||
asset output.js 19.2 KiB [emitted] (name: main)
|
||||
asset images/89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
|
||||
asset images/afc10c70ed4ce2b33593.svg 656 bytes [emitted] [immutable] [from: images/url.svg] (auxiliary name: main)
|
||||
chunk (runtime: main) output.js (main) 12.4 KiB (javascript) 15.2 KiB (asset) 1.46 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: main) output.js (main) 12.4 KiB (javascript) 15.2 KiB (asset) 1.48 KiB (runtime) [entry] [rendered]
|
||||
> ./example.js main
|
||||
dependent modules 9.59 KiB (javascript) 15.2 KiB (asset) [dependent] 6 modules
|
||||
runtime modules 1.46 KiB 5 modules
|
||||
runtime modules 1.48 KiB 5 modules
|
||||
./example.js 2.85 KiB [built] [code generated]
|
||||
[no exports]
|
||||
[used exports unknown]
|
||||
|
|
|
@ -286,7 +286,7 @@ export const add = (content, from) => {
|
|||
/******/
|
||||
/******/ /* webpack/runtime/jsonp chunk loading */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.b = (document && document.baseURI) || self.location.href;
|
||||
/******/ __webpack_require__.b = (typeof document !== 'undefined' && document.baseURI) || self.location.href;
|
||||
/******/
|
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
|
@ -722,7 +722,7 @@ function fibonacci(n) {
|
|||
## Unoptimized
|
||||
|
||||
```
|
||||
asset main.js 11.8 KiB [emitted] (name: main)
|
||||
asset main.js 11.9 KiB [emitted] (name: main)
|
||||
asset workers/fibonacci.js 4.99 KiB [emitted] (name: fibonacci)
|
||||
asset chat.js 839 bytes [emitted] (name: chat)
|
||||
asset 129.js 741 bytes [emitted]
|
||||
|
@ -746,9 +746,9 @@ chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes
|
|||
./fib-worker.js 176 bytes [built] [code generated]
|
||||
[no exports used]
|
||||
new Worker() ./fib-worker.js ./example.js 80:18-84:2
|
||||
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.4 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.42 KiB (runtime) [entry] [rendered]
|
||||
> ./example.js main
|
||||
runtime modules 5.4 KiB 7 modules
|
||||
runtime modules 5.42 KiB 7 modules
|
||||
./example.js 2.25 KiB [built] [code generated]
|
||||
[no exports used]
|
||||
entry ./example.js main
|
||||
|
@ -758,7 +758,7 @@ webpack X.X.X compiled successfully
|
|||
## Production mode
|
||||
|
||||
```
|
||||
asset main.js 3.27 KiB [emitted] [minimized] (name: main)
|
||||
asset main.js 3.29 KiB [emitted] [minimized] (name: main)
|
||||
asset workers/fibonacci.js 776 bytes [emitted] [minimized] (name: fibonacci)
|
||||
asset chat.js 270 bytes [emitted] [minimized] (name: chat)
|
||||
asset 129.js 159 bytes [emitted] [minimized]
|
||||
|
@ -782,9 +782,9 @@ chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes
|
|||
./fib-worker.js 176 bytes [built] [code generated]
|
||||
[no exports used]
|
||||
new Worker() ./fib-worker.js ./example.js 80:18-84:2
|
||||
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.4 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.42 KiB (runtime) [entry] [rendered]
|
||||
> ./example.js main
|
||||
runtime modules 5.4 KiB 7 modules
|
||||
runtime modules 5.42 KiB 7 modules
|
||||
./example.js 2.25 KiB [built] [code generated]
|
||||
[no exports used]
|
||||
entry ./example.js main
|
||||
|
|
|
@ -465,21 +465,6 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
const taskCompletionMessage = () =>
|
||||
InstrumentHooks.isInstrumented() ? "Measured" : "Checked";
|
||||
|
||||
const iterationAsync = async (task) => {
|
||||
try {
|
||||
await task.fnOpts.beforeEach?.call(task, "run");
|
||||
const start = bench.opts.now();
|
||||
await task.fn();
|
||||
const end = bench.opts.now() - start || 0;
|
||||
await task.fnOpts.afterEach?.call(this, "run");
|
||||
return [start, end];
|
||||
} catch (err) {
|
||||
if (bench.opts.throws) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const wrapWithInstrumentHooksAsync = async (fn, uri) => {
|
||||
InstrumentHooks.startBenchmark();
|
||||
const result = await fn();
|
||||
|
@ -489,7 +474,29 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
};
|
||||
|
||||
const runTaskAsync = async (task, uri) => {
|
||||
const { fnOpts, fn } = task;
|
||||
const { name, fn, fnOpts } = task;
|
||||
const originalFn = fn;
|
||||
|
||||
const fnWrapper = async () => {
|
||||
console.time(`Time: ${name}`);
|
||||
await originalFn();
|
||||
console.timeEnd(`Time: ${name}`);
|
||||
};
|
||||
|
||||
const iterationAsync = async (task) => {
|
||||
try {
|
||||
await task.fnOpts.beforeEach?.call(task, "run");
|
||||
const start = bench.opts.now();
|
||||
await fnWrapper();
|
||||
const end = bench.opts.now();
|
||||
await task.fnOpts.afterEach?.call(this, "run");
|
||||
return [start, end, end - start];
|
||||
} catch (err) {
|
||||
if (bench.opts.throws) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Custom setup
|
||||
await bench.opts.setup?.(task, "run");
|
||||
|
@ -507,7 +514,10 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
await fnOpts?.beforeEach?.call(task, "run");
|
||||
await mongoMeasurement.start(uri);
|
||||
global.gc?.();
|
||||
await wrapWithInstrumentHooksAsync(wrapFunctionWithFrame(fn, true), uri);
|
||||
await wrapWithInstrumentHooksAsync(
|
||||
wrapFunctionWithFrame(fnWrapper, true),
|
||||
uri
|
||||
);
|
||||
await mongoMeasurement.stop(uri);
|
||||
await fnOpts?.afterEach?.call(task, "run");
|
||||
console.log(`[Codspeed] ✔ Measured ${uri}`);
|
||||
|
@ -519,21 +529,6 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
logTaskCompletion(uri, taskCompletionMessage());
|
||||
};
|
||||
|
||||
const iteration = (task) => {
|
||||
try {
|
||||
task.fnOpts.beforeEach?.call(task, "run");
|
||||
const start = bench.opts.now();
|
||||
task.fn();
|
||||
const end = bench.opts.now() - start || 0;
|
||||
task.fnOpts.afterEach?.call(this, "run");
|
||||
return [start, end];
|
||||
} catch (err) {
|
||||
if (bench.opts.throws) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const wrapWithInstrumentHooks = (fn, uri) => {
|
||||
InstrumentHooks.startBenchmark();
|
||||
const result = fn();
|
||||
|
@ -543,7 +538,29 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
};
|
||||
|
||||
const runTaskSync = (task, uri) => {
|
||||
const { fnOpts, fn } = task;
|
||||
const { name, fnOpts, fn } = task;
|
||||
const originalFn = fn;
|
||||
|
||||
const fnWrapper = () => {
|
||||
console.time(`Time: ${name}`);
|
||||
originalFn();
|
||||
console.timeEnd(`Time: ${name}`);
|
||||
};
|
||||
|
||||
const iteration = (task) => {
|
||||
try {
|
||||
task.fnOpts.beforeEach?.call(task, "run");
|
||||
const start = bench.opts.now();
|
||||
task.fn();
|
||||
const end = bench.opts.now() - start || 0;
|
||||
task.fnOpts.afterEach?.call(this, "run");
|
||||
return [start, end];
|
||||
} catch (err) {
|
||||
if (bench.opts.throws) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Custom setup
|
||||
bench.opts.setup?.(task, "run");
|
||||
|
@ -559,7 +576,7 @@ const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
|
|||
|
||||
fnOpts?.beforeEach?.call(task, "run");
|
||||
|
||||
wrapWithInstrumentHooks(wrapFunctionWithFrame(fn, false), uri);
|
||||
wrapWithInstrumentHooks(wrapFunctionWithFrame(fnWrapper, false), uri);
|
||||
|
||||
fnOpts?.afterEach?.call(task, "run");
|
||||
console.log(`[Codspeed] ✔ Measured ${uri}`);
|
||||
|
@ -693,8 +710,6 @@ async function registerSuite(bench, test, baselines) {
|
|||
bench.add(
|
||||
benchName,
|
||||
async () => {
|
||||
console.time(`Time: ${benchName}`);
|
||||
|
||||
let resolve;
|
||||
let reject;
|
||||
|
||||
|
@ -717,7 +732,6 @@ async function registerSuite(bench, test, baselines) {
|
|||
// Construct and print stats to be more accurate with real life projects
|
||||
stats.toString();
|
||||
resolve();
|
||||
console.timeEnd(`Time: ${benchName}`);
|
||||
};
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
|
@ -836,9 +850,7 @@ async function registerSuite(bench, test, baselines) {
|
|||
runWebpack(webpack, config)
|
||||
);
|
||||
} else {
|
||||
console.time(`Time: ${benchName}`);
|
||||
await runWebpack(webpack, config);
|
||||
console.timeEnd(`Time: ${benchName}`);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue