Skip to content

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jul 4, 2025

Summary

The DateType library has some very large protocols in it. Currently we type-check it quite quickly, but the current version of #18659 makes our execution time on this library pathologically slow. That PR doesn't seem to have a big impact on any of our current benchmarks, however, so it seems we have some missing coverage in this area; I therefore propose that we add DateType as a benchmark.

Currently the benchmark runs pretty quickly (about half the runtime of attrs, which is our fastest real-world benchmark currently), and the library has 0 third-party dependencies, so the benchmark is quick to setup.

Test Plan

cargo bench -p ruff_benchmark --bench=ty

@AlexWaygood AlexWaygood added performance Potential performance improvement testing Related to testing Ruff itself ty Multi-file analysis & type inference labels Jul 4, 2025
Comment on lines 500 to 503
assert!(
diagnostics > 1 && diagnostics <= max_diagnostics,
"Expected between {} and {} diagnostics but got {}",
1,
max_diagnostics,
diagnostics
diagnostics <= max_diagnostics,
"Expected <={max_diagnostics} diagnostics but got {diagnostics}"
);
Copy link
Member Author

@AlexWaygood AlexWaygood Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't emit any diagnostics on this library (it's well-typed!), so this assertion didn't pass as-is as it expects at least 1 diagnostic

@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood AlexWaygood merged commit 44f2f77 into main Jul 4, 2025
37 checks passed
@AlexWaygood AlexWaygood deleted the alex/datetype-bench branch July 4, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Potential performance improvement testing Related to testing Ruff itself ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants