Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,20 @@ jobs:
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}

benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: "npm"
- name: Install dependencies
run: npm install --ignore-scripts --no-audit --no-fund
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: node benchmarks/benchmarks.js
496 changes: 496 additions & 0 deletions benchmarks/__fixtures__/nerdy.dev.css

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions benchmarks/__fixtures__/syntax.fm.css

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions benchmarks/__fixtures__/tailwindcss.com.css

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions benchmarks/__fixtures__/vistaprint.nl.css

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions benchmarks/benchmarks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Bench } from "tinybench";
import { withCodSpeed } from "@codspeed/tinybench-plugin";
import * as fs from "fs";
import { format } from '../index.js'

let filelist = fs.readdirSync('./benchmarks/__fixtures__')

let bench = withCodSpeed(new Bench())

for (let filename of filelist) {
let css = fs.readFileSync(`./benchmarks/__fixtures__/${filename}`, 'utf8')
let byte_size = (Buffer.byteLength(css) / 1024).toFixed(1)
bench.add(`${filename} (${byte_size}kB)`, () => format(css))
}

await bench.run()

console.table(bench.table())
Loading