[ty] Add separate CI job for memory usage stats (#19134)

## Summary

As discussed in https://github.com/astral-sh/ruff/pull/19059.
This commit is contained in:
Ibraheem Ahmed 2025-07-07 12:17:02 -04:00 committed by GitHub
parent 56258bb3b7
commit cd848986d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 118 additions and 44 deletions

View file

@ -296,6 +296,11 @@ impl MainLoop {
tracing::warn!("No python files found under the given path(s)");
}
// TODO: We should have an official flag to silence workspace diagnostics.
if std::env::var("TY_MEMORY_REPORT").as_deref() == Ok("mypy_primer") {
return Ok(ExitStatus::Success);
}
let mut stdout = stdout().lock();
if result.is_empty() {

View file

@ -324,8 +324,8 @@ impl SalsaMemoryDump {
struct DisplayShort<'a>(&'a SalsaMemoryDump);
fn round_memory(total: usize) -> usize {
// Round the number to the nearest power of 1.1. This gives us a
// 5% threshold before the memory usage number is considered to have
// Round the number to the nearest power of 1.05. This gives us a
// 2.5% threshold before the memory usage number is considered to have
// changed.
//
// TODO: Small changes in memory usage may cause the number to be rounded
@ -334,7 +334,7 @@ impl SalsaMemoryDump {
// over time that are unrelated to the current change. Ideally we could compare
// the exact numbers across runs and compute the difference, but we don't have
// the infrastructure for that currently.
const BASE: f64 = 1.1;
const BASE: f64 = 1.05;
BASE.powf(bytes_to_mb(total).log(BASE).round()) as usize
}

View file

@ -0,0 +1,4 @@
flake8
sphinx
prefect
trio