Skip to content

Commit f3fc813

Browse files
committed
Add line table benchmark
1 parent 347d9e2 commit f3fc813

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { readFileSync } from 'node:fs'
2+
import { fileURLToPath } from 'node:url'
3+
4+
import { bench } from 'vitest'
5+
import { createLineTable } from './line-table'
6+
7+
const currentFolder = fileURLToPath(new URL('..', import.meta.url))
8+
const cssFile = readFileSync(currentFolder + '../preflight.css', 'utf-8')
9+
const table = createLineTable(cssFile)
10+
11+
bench('line table lookups', () => {
12+
for (let i = 0; i < cssFile.length; ++i) table.find(i)
13+
})

0 commit comments

Comments
 (0)