Skip to content

Instantly share code, notes, and snippets.

@mattdesl
Created November 22, 2020 18:49
Show Gist options
  • Save mattdesl/f6a3192c89e1d182c26ceed28130e92c to your computer and use it in GitHub Desktop.
Save mattdesl/f6a3192c89e1d182c26ceed28130e92c to your computer and use it in GitHub Desktop.
const esbuild = require("esbuild");
const entry = require.resolve("./three");
(async () => {
const service = await esbuild.startService();
let sum = 0;
let count = 0;
const result = await service.build({
entryPoints: [entry],
bundle: true,
write: false,
incremental: true,
sourcemap: true, // <---- slows things down quite a bit
});
const times = new Array(50).fill(0);
await times.reduce(async (p, _) => {
await p;
const now = Date.now();
const start = Date.now();
await result.rebuild();
const delta = Date.now() - start;
sum += delta;
count++;
}, Promise.resolve());
sum /= count;
console.log("Average Time", sum);
await service.stop();
})();
import * as THREE from "three";
console.log("hello world");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment