Skip to content

Commit 8ccda14

Browse files
committed
More benchmarks
1 parent d9fc0f0 commit 8ccda14

File tree

8 files changed

+490
-349
lines changed

8 files changed

+490
-349
lines changed

scripts/ty_benchmark/pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name = "ty_benchmark"
33
version = "0.0.1"
44
description = "Package for running end-to-end ty benchmarks"
55
requires-python = ">=3.12"
6-
dependencies = ["mypy", "pyright"]
6+
dependencies = [
7+
"pyrefly>=0.41.3",
8+
"pyright",
9+
]
710

811
[project.scripts]
912
benchmark = "benchmark.run:main"
@@ -19,3 +22,5 @@ packages = ["src/benchmark"]
1922
ignore = [
2023
"E501", # We use ruff format
2124
]
25+
26+
[tool.ty]

scripts/ty_benchmark/src/benchmark/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import logging
44
import shlex
55
import subprocess
6-
import typing
76
from pathlib import Path
7+
from typing import Mapping, NamedTuple
88

99

10-
class Command(typing.NamedTuple):
10+
class Command(NamedTuple):
1111
name: str
1212
"""The name of the command to benchmark."""
1313

@@ -18,7 +18,7 @@ class Command(typing.NamedTuple):
1818
"""The command to run before each benchmark run."""
1919

2020

21-
class Hyperfine(typing.NamedTuple):
21+
class Hyperfine(NamedTuple):
2222
name: str
2323
"""The benchmark to run."""
2424

@@ -37,13 +37,16 @@ class Hyperfine(typing.NamedTuple):
3737
json: bool
3838
"""Whether to export results to JSON."""
3939

40-
def run(self, *, cwd: Path | None = None) -> None:
40+
def run(self, *, cwd: Path | None = None, env: Mapping[str, str] = dict()) -> None:
4141
"""Run the benchmark using `hyperfine`."""
4242
args = [
4343
"hyperfine",
44-
# Most repositories have some typing errors.
45-
# This is annoying because it prevents us from capturing "real" errors.
46-
"-i",
44+
# Ignore any warning/error diagnostics but fail if there are any fatal errors, incorrect configuration, etc.
45+
# mypy exit codes: https://github.com/python/mypy/issues/14615#issuecomment-1420163253
46+
# pyright exit codes: https://docs.basedpyright.com/v1.31.6/configuration/command-line/#pyright-exit-codes
47+
# pyrefly exit codes: Not documented
48+
# ty: https://docs.astral.sh/ty/reference/exit-codes/
49+
"-i=1",
4750
]
4851

4952
# Export to JSON.
@@ -70,7 +73,4 @@ def run(self, *, cwd: Path | None = None) -> None:
7073

7174
logging.info(f"Running {args}")
7275

73-
subprocess.run(
74-
args,
75-
cwd=cwd,
76-
)
76+
subprocess.run(args, cwd=cwd, env=env)

scripts/ty_benchmark/src/benchmark/cases.py

Lines changed: 0 additions & 217 deletions
This file was deleted.

0 commit comments

Comments
 (0)