Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pmdartus/prettier-benchmark

Performance benchmark for Prettier CLI
https://github.com/pmdartus/prettier-benchmark

Last synced: 8 days ago
JSON representation

Performance benchmark for Prettier CLI

Awesome Lists containing this project

README

        

# Prettier performance benchmark

Checkout and build locally different versions of Prettier, and compare the performance of multiple CLI version against large JavaScript / TypeScript repositories. The performance comparison is done using [hyperfine](https://github.com/sharkdp/hyperfine).

## Scripts

### `scripts/setup-prettier.sh`

**Description:** Install and build a specific version of prettier.

**Usage:** `./scripts/setup-prettier.sh `

**Arguments:**

- `directory`: The prettier installation directory.
- `github-reference`: The github shorthand reference of a prettier repository.

**Example:**

```sh
$ ./scripts/setup-prettier.sh baseline "prettier/prettier#main"
```

### `scripts/benchmark.js`

**Description:** Run Prettier CLI performance benchmark

**Usage:** `./scripts/benchmark.js [options] [name]`

**Arguments:**
- `name`: The name of the benchmark to run. If omitted, the CLI runs all the benchmarks.

**Options:**

- `--baseline `: The baseline Prettier CLI filename. (required)
- `--target `: The target Prettier CLI filename.
- `--runs `: Number of iteration to perform for each command. (default: `10`)
- `--warmup `: Number of iteration used to warmup the command. (default: `1`)
- `--export-json `: Export benchmark results as JSON to the `filename`.
- `--export-markdown `: Export benchmark results as markdown to the `filename`.
- `--verbose`: Print debug logs and Prettier CLI output.

**Example:**
```sh
$ ./scripts/benchmark.js \
--baseline ./node_modules/prettier/bin/prettier.cjs \
--runs 5 \
vue
```