ruff/scripts/knot_benchmark
David Peter 085a43a262
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz (push) Blocked by required conditions
CI / Fuzz the parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[red-knot] knot benchmark: fix --knot-path arg (#13923)
## Summary

Previously, this would fail with

```
AttributeError: 'str' object has no attribute 'is_file'
```

if I tried to use the `--knot-path` option. I wish we had a type checker
for Python*.

## Test Plan

```sh
uv run benchmark --knot-path ~/.cargo-target/release/red_knot
```

\* to be fair, this would probably require special handling for
`argparse` in the typechecker.
2024-10-25 11:43:39 +02:00
..
src/benchmark [red-knot] knot benchmark: fix --knot-path arg (#13923) 2024-10-25 11:43:39 +02:00
pyproject.toml Add basic red knot benchmark (#13026) 2024-08-23 08:22:42 +02:00
README.md Add basic red knot benchmark (#13026) 2024-08-23 08:22:42 +02:00
uv.lock Add basic red knot benchmark (#13026) 2024-08-23 08:22:42 +02:00

Getting started

  1. Install uv
  • Unix: curl -LsSf https://astral.sh/uv/install.sh | sh
  • Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. Build red_knot: cargo build --bin red_knot --release
  2. cd into the benchmark directory: cd scripts/knot_benchmark
  3. Run benchmarks: uv run benchmark

Known limitations

Red Knot only implements a tiny fraction of Mypy's and Pyright's functionality, so the benchmarks aren't in any way a fair comparison today. However, they'll become more meaningful as we build out more type checking features in Red Knot.

Windows support

The script should work on Windows, but we haven't tested it yet. We do make use of shlex which has known limitations when using non-POSIX shells.