microsoft / pyright

Static Type Checker for Python
Other
12.7k stars 1.35k forks source link

Performance issue when analyzing aiohttp project #8276

Closed erictraut closed 2 weeks ago

erictraut commented 2 weeks ago

This is related to https://github.com/microsoft/pyright/issues/8272. I'm creating issues for each hang so I can track them separately.

This particular issue specifically affects the ClientSession._request method in module aiohttp/client.py.

To repro:

erictraut commented 2 weeks ago

This shape of the code flow graph for this method is causing pyright to perform repeated (redundant) reachability analysis. I've added a mechanism to cache the reachability results for code flow nodes. This reduces the total analysis time for this project from 111s to 5s on my machine.

erictraut commented 2 weeks ago

This is addressed in pyright 1.1.370