Created
November 22, 2020 18:49
-
-
Save mattdesl/f6a3192c89e1d182c26ceed28130e92c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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