https://github.com/yowainwright/format-comparison-benchmark
A quick Frontend related (JS, JSON, MD, CSS) format comparison test
https://github.com/yowainwright/format-comparison-benchmark
Last synced: 10 days ago
JSON representation
A quick Frontend related (JS, JSON, MD, CSS) format comparison test
- Host: GitHub
- URL: https://github.com/yowainwright/format-comparison-benchmark
- Owner: yowainwright
- License: mit
- Created: 2022-04-06T05:53:22.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-07T22:54:58.000Z (over 2 years ago)
- Last Synced: 2025-02-21T14:31:27.385Z (over 1 year ago)
- Language: CSS
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Rome vs Prettier Format Comparison Benchmark
The npm scripts within this repository's `package.json` can be used to compare Rome Format vs Prettier. Initial notes written 04/06/2022. The scripts were written to be run on Mac. Specifically, a M1 Mac Pro was used.
> I'm excited about [Rome tools](https://rome.tools/) and [Rust](https://www.rust-lang.org/) 🦀 so I decided to do my own experiment after [this post](https://rome.tools/blog/2022/04/05/rome-formatter-release)!
---
## Setup
Utilities setup
```sh
nvm i && npm i pnpm -g && pnpm i
```
Running scripts
```sh
pnpm :
# see all available script in the package.json > script or in the #scripts section below
```
## Scripts
- **`test:prettier:js`**: Run prettier on all JavaScript files added to a temp directory.
- **`test:rome:js`**: Run rome format on all JavaScript files added to temp directory.
- **`test:prettier:all`**: Run prettier on all CSS, JSON, JavaScript, Markdown in a temp directory.
- **`test:rome:feature-parity`**: Run rome format, markdownlint, jsonlint, and stylelint on all CSS, JSON, JavaScript, Markdown in a temp directory.
### Script Anatomy
Each script creates a temp directory (`/dump`), copies config files and [rambda](https://www.npmjs.com/package/ramda) from `node_modules` to run prettier and rome format. Tiems are measured using [gnomon](https://www.npmjs.com/package/gnomon).👌
---
## Benchmarks
Local Benchmarks
| Script | Rome | Prettier |
| :---: | :---: | :---: |
| js only | 1.5404s | 2.0353s |
| all | *2.2669s | 2.7163s |
Initial [Github Action Benchmarks](https://github.com/yowainwright/format-comparison-benchmark/actions)
| Script | Rome | Prettier |
| :---: | :---: | :---: |
| js only | 17s | 18s |
| all | *12s | 17s |
\*I think I've written the script `test:rome:feature-parity` so that stylelint & markdownlint basically don't run. Will review. 🧐
---
## Some code was copied from these projects for speed 🏎️
- **[kerns](https://raw.githubusercontent.com/kerns/dummy/master/README.md)**: a dummy toolkit
- **[jsonplaceholder](https://jsonplaceholder.typicode.com/)** a json placeholder toolkit
- **[Simple CSS](https://simplecss.org/)**: a no-css-class css framework