Skip to content

Commit 3c7073f

Browse files
H4adadamwathan
andauthored
Perf: Use charCodeAt instead of string comparison (#13393)
* Use charCodeAt instead of string comparison * Rename some things * Fix lint issues --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent 818692f commit 3c7073f

File tree

2 files changed

+123
-70
lines changed

2 files changed

+123
-70
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { readFileSync } from 'node:fs'
2+
import { bench } from 'vitest'
3+
import * as CSS from './src/css-parser.ts'
4+
5+
const currentFolder = new URL('.', import.meta.url).pathname
6+
const cssFile = readFileSync(currentFolder + './preflight.css', 'utf-8')
7+
8+
bench('css-parser on preflight.css', () => {
9+
CSS.parse(cssFile)
10+
})

0 commit comments

Comments
 (0)