镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Commit e21e730

Browse files
committed
chore: wip
1 parent aa54994 commit e21e730

18 files changed

Lines changed: 10761 additions & 10 deletions

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ docs/.vitepress/cache
1414
packages/pickier/bin/pickier
1515
.vscode
1616
/pantry
17+
/packages/zig/.zig-cache
18+
/packages/zig/zig-out

‎bechmarks/benchmarks/format-comparison.bench.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Pickier vs oxfmt vs Biome vs Prettier — Formatting Benchmark
33
*
4-
* All four tools compared in every group:
4+
* All tools compared in every group:
55
*
66
* 1. Programmatic / In-memory
77
* Pickier formatCode() — in-memory, no process spawn
@@ -11,6 +11,7 @@
1111
*
1212
* 2. CLI (single file)
1313
* All tools spawn a subprocess.
14+
* Pickier uses its Zig-compiled native binary for max speed.
1415
*
1516
* 3. CLI Batch (all fixtures sequentially)
1617
*
@@ -65,7 +66,7 @@ const biomeGlobal = which('biome')
6566
const biomeCmd = biomeGlobal ?? 'npx --yes @biomejs/biome'
6667
const prettierGlobal = which('prettier')
6768
const prettierCmd = prettierGlobal ?? 'npx --yes prettier'
68-
const pickierBin = resolve(__dirname, '../../packages/pickier/bin/pickier')
69+
const pickierZigBin = resolve(__dirname, '../../packages/zig/zig-out/bin/pickier-zig')
6970

7071
// Warm up npx cache so the first bench iteration isn't penalised
7172
try { execSync(`${oxfmtCmd} --version`, { stdio: 'ignore' }) } catch { /* ignore */ }
@@ -124,9 +125,8 @@ function cliPrettier(filePath: string): void {
124125

125126
function cliPickier(filePath: string): void {
126127
try {
127-
execSync(`${pickierBin} run ${filePath} --mode format --check`, {
128+
execSync(`${pickierZigBin} run ${filePath} --mode format --check`, {
128129
stdio: 'ignore',
129-
env: { ...process.env, PICKIER_NO_AUTO_CONFIG: '1' },
130130
})
131131
}
132132
catch { /* non-zero exit expected */ }
@@ -136,15 +136,15 @@ function cliPickier(filePath: string): void {
136136
// Header
137137
// ---------------------------------------------------------------------------
138138
console.log(`\n${'='.repeat(80)}`)
139-
console.log(' PICKIER vs OXFMT vs BIOME vs PRETTIER — Formatting Benchmark')
139+
console.log(' PICKIER (Zig) vs OXFMT vs BIOME vs PRETTIER — Formatting Benchmark')
140140
console.log('='.repeat(80))
141141
console.log('\nFixtures:')
142142
console.log(` Small: ${stats.small.lines} lines (${(stats.small.bytes / 1024).toFixed(1)} KB)`)
143143
console.log(` Medium: ${stats.medium.lines} lines (${(stats.medium.bytes / 1024).toFixed(1)} KB)`)
144144
console.log(` Large: ${stats.large.lines} lines (${(stats.large.bytes / 1024).toFixed(1)} KB)`)
145145
console.log()
146146
console.log('Tools:')
147-
console.log(` Pickier: formatCode() in-memory + compiled binary CLI`)
147+
console.log(` Pickier: formatCode() in-memory + Zig-compiled native binary CLI`)
148148
console.log(` oxfmt: ${oxfmtGlobal ?? '(via npx)'} — stdin pipe + CLI (no JS API)`)
149149
console.log(` Biome: ${biomeGlobal ?? '(via npx)'} — stdin pipe + CLI (no JS formatting API)`)
150150
console.log(` Prettier: format() in-memory + ${prettierGlobal ?? 'npx'} CLI`)
@@ -180,7 +180,7 @@ for (const [label, size] of [['Small', 'small'], ['Medium', 'medium'], ['Large',
180180

181181
for (const [label, size] of [['Small', 'small'], ['Medium', 'medium'], ['Large', 'large']] as const) {
182182
group(`CLI — ${label} File (${stats[size].lines} lines)`, () => {
183-
bench('Pickier', () => {
183+
bench('Pickier (Zig)', () => {
184184
cliPickier(fixturePaths[size])
185185
})
186186

@@ -203,7 +203,7 @@ for (const [label, size] of [['Small', 'small'], ['Medium', 'medium'], ['Large',
203203
// ===================================================================
204204

205205
group('CLI Batch — All Files', () => {
206-
bench('Pickier', () => {
206+
bench('Pickier (Zig)', () => {
207207
for (const fp of Object.values(fixturePaths)) cliPickier(fp)
208208
})
209209

‎bun.lock‎

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)