Skip to content

Commit 128bfe5

Browse files
committed
Update perf.js
1 parent c121f93 commit 128bfe5

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/perf.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import test from 'tst'
22

33
const RUNS = 3e4
44
const src = c => `1 + (a * b / c % d) - 2.0 + -3e-3 * +4.4e4 / f.g[0] - i.j(+k == 1)(${c})`
5+
const subscriptUrl = new URL('../subscript.js', import.meta.url).href
6+
const justinUrl = new URL('../justin.js', import.meta.url).href
57

6-
test.fork('perf: expr < jsep', {data: {RUNS, src}}, async ({ ok }, {RUNS, src}) => {
8+
test.fork('perf: expr < jsep', {data: {RUNS, src, subscriptUrl}}, async ({ ok }, {RUNS, src, subscriptUrl}) => {
79
const bench = (fn) => {
810
let best = Infinity
911
for (let r = 0; r < 3; r++) {
@@ -14,7 +16,7 @@ test.fork('perf: expr < jsep', {data: {RUNS, src}}, async ({ ok }, {RUNS, src})
1416
return best
1517
}
1618

17-
const { parse } = await import('file:///Users/div/projects/subscript/subscript.js')
19+
const { parse } = await import(subscriptUrl)
1820
const jsep = (await import('jsep')).default
1921

2022
for (let w = 0; w < RUNS; w++) { parse(src(w)); jsep(src(w)) }
@@ -25,7 +27,7 @@ test.fork('perf: expr < jsep', {data: {RUNS, src}}, async ({ ok }, {RUNS, src})
2527
ok(time < baseline, `expr (${time.toFixed(0)}ms) should be < jsep (${baseline.toFixed(0)}ms)`)
2628
})
2729

28-
test.fork('perf: justin <= jsep', {data: {RUNS, src}}, async ({ ok }, {RUNS, src}) => {
30+
test.fork('perf: justin <= jsep', {data: {RUNS, src, justinUrl}}, async ({ ok }, {RUNS, src, justinUrl}) => {
2931
const bench = (fn) => {
3032
let best = Infinity
3133
for (let r = 0; r < 3; r++) {
@@ -36,7 +38,7 @@ test.fork('perf: justin <= jsep', {data: {RUNS, src}}, async ({ ok }, {RUNS, src
3638
return best
3739
}
3840

39-
const { parse } = await import('file:///Users/div/projects/subscript/justin.js')
41+
const { parse } = await import(justinUrl)
4042
const jsep = (await import('jsep')).default
4143

4244
for (let w = 0; w < RUNS; w++) { parse(src(w)); jsep(src(w)) }

0 commit comments

Comments
 (0)