wemake-python-styleguide icon indicating copy to clipboard operation
wemake-python-styleguide copied to clipboard

Document `darglint`'s performance issues

Open webknjaz opened this issue 4 years ago • 2 comments

What's wrong

While integrating WPS into yet another project, I've hit a case where it caused flake8 to run for over 11 minutes on a relatively performant laptop. Having not seen this before, it was a bit challenging to figure out the cause but I've armed myself with py-spy, and after an hour of staring at the terminal and helpful visualizations, I've discovered that some of the darglint's style parsers are slow, in particular in the corner case I've hit where it took it about 10 minutes to lint a single file with its default google style linter. Turned out that I usually set it to sphinx style which is why I've never seen this performance disaster in the past. On my machine with the affected file, google was 4360x slower than sphinx. And numpy was 3420x slower than sphinx.

The upstream issue and the adventure details are here: https://github.com/terrencepreilly/darglint/issues/186.

How it should be

This should be documented and linked to the upstream issue. Alternatively, this linter could be made optional to allow for not using it. A suggestion could be made to use sphinx style if the problem is hit.

Flake8 version and plugins

Doesn't matter.

pip information

Doesn't matter.

OS information

Gentoo Linux, but the performance problem has been observed on the computers of my colleagues running macOS and Fedora. As well as in the CI — pre-commit.ci GitHub App and Zuul (with Fedora/CentOS IIRC).

webknjaz avatar Dec 10 '21 21:12 webknjaz

Oh wow, thanks a lot for the report! I hope that this can be fixed on darglint's side.

sobolevn avatar Dec 11 '21 09:12 sobolevn

I hope so too but that project is in maintenance mode and unless people who use the affected styles contribute, it'll take time. This is why I propose to mark this as good first issue and let somebody contribute a small docs note pointing at these issues.

webknjaz avatar Dec 11 '21 17:12 webknjaz