Add line table benchmark
This commit is contained in:
parent
347d9e2971
commit
f3fc8137f2
1 changed files with 13 additions and 0 deletions
13
packages/tailwindcss/src/source-maps/line-table.bench.ts
Normal file
13
packages/tailwindcss/src/source-maps/line-table.bench.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { readFileSync } from 'node:fs'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import { bench } from 'vitest'
|
||||
import { createLineTable } from './line-table'
|
||||
|
||||
const currentFolder = fileURLToPath(new URL('..', import.meta.url))
|
||||
const cssFile = readFileSync(currentFolder + '../preflight.css', 'utf-8')
|
||||
const table = createLineTable(cssFile)
|
||||
|
||||
bench('line table lookups', () => {
|
||||
for (let i = 0; i < cssFile.length; ++i) table.find(i)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue