Skip to content

Optimizing speed of the starting and initialisation phase #4814

@Hubro

Description

@Hubro

Current problem

Pylint is frustratingly slow, taking several seconds to lint even tiny, simple Python files. Pylint is glacially slow compared to any linting tool in any other language I have worked with. This slowness is not too big a problem for CI/CD pipelines, since in this context a few seconds doesn't matter too much and linting of multiple files can be parallelized.

However, for background linting in editors while editing (for example with ALE) this leads to a terrible experience of warnings popping up seconds after I've moved past a line, or warnings staying up seconds after I've resolved them.

Since Python is not a slow language, I assume this slowness has to do with one or more linter settings. However, since there are hundreds of settings, I have no idea where to begin with improving the performance.

My goal would be to get a pylint run on a single file to take somewhere in the ballpark of 100 ms.

Desired solution

I would like a section in the front page README, or a separate guide linked to from the README file, with suggestions for how to improve the performance of pylint, for example disabling certain options that are particularly taxing.

Linting 80 lines of Python should not take 2.5 seconds, at the very most it should take maybe 100 ms.

Additional context

My pylint config: https://gist.github.com/Hubro/7adba88c42e4df0706067bfe9b2cea53#file-pylintrc-ini

The file I'm currently linting: https://gist.github.com/Hubro/7adba88c42e4df0706067bfe9b2cea53#file-generic_http_mock_server-py

➜ \pylint --version
pylint 2.8.3
astroid 2.5.6
Python 3.8.6 (default, Jun 27 2021, 03:28:09)
[GCC 11.1.0]
➜ time \pylint --rcfile=pylintrc.ini generic_http_mock_server.py
************* Module generic_http_mock_server
generic_http_mock_server.py:28:0: C0115: Missing class docstring (missing-class-docstring)
\pylint --rcfile=pylintrc.ini   2.30s user 0.15s system 101% cpu 2.416 total

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions