-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbun_test.ts
35 lines (27 loc) · 842 Bytes
/
bun_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { $ } from 'bun'
async function bun_build() {
const start = performance.now()
await $`bun build:linux`.quiet()
return performance.now() - start
}
async function node_build() {
const start = performance.now()
await $`npm run build:linux`.quiet()
return performance.now() - start
}
let node_total_time = 0
let bun_total_time = 0
async function main() {
const bun_time = await bun_build()
console.log(`bun: ${bun_time} ms`)
const node_time = await node_build()
console.log(`node: ${node_time} ms\n`)
bun_total_time += bun_time
node_total_time += node_time
}
for (let i = 0; i < 10; i++)
await main()
console.log('------------------')
console.log(`bun average: ${bun_total_time / 10} ms`)
console.log(`node average: ${node_total_time / 10} ms`)
console.log('------------------')