Skip to content

Measure Linux benchmark peak RSS with wait4 - #165

Open
sharkdp wants to merge 1 commit into
lolpack:mainfrom
sharkdp:codex/linux-peak-rss
Open

sharkdp wants to merge 1 commit into
lolpack:mainfrom
sharkdp:codex/linux-peak-rss

Conversation

@sharkdp

@sharkdp sharkdp commented Nov 3, 2026 •

Copy link
Copy Markdown

Fixes #161.

Use a blocking wait4() on Linux to collect peak RSS when the type-checker exits (the OOM watcher still uses /proc/<pid>/status for querying while the process is still running).

I ran a benchmark for each type-checker on "cerify". Each cell shows min..max peak RSS in MiB for five benchmarking runs. GNU time is used for comparison. As we can tell from this table, the new ("After") results are closed to the time measurements, especially for the fast-running type checkers. The previous implementation could miss as much as 13 MiB, or 20% of the peak RSS (see e.g. the "min" times in the Pyrefly row):

Checker Before After GNU time
Pyright 141.7..142.8 141.8..142.6 141.7..142.3
Pyrefly 51.9..65.2 64.2..64.6 64.4..64.6
ty 37.6..42.6 46.9..47.4 46.9..47.5
mypy 114.7..115.4 114.7..115.1 114.6..115.4
Zuban 27.2..27.5 32.9..33.1 33.0..33.3

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peak memory usage measurements may be inaccurate or missing on Linux

1 participant