Skip to content

Slow incremental run when single module has errors #4135

Closed

Description

@JukkaL

mypy -i is slower than expected in the following scenario:

  • Check out fresh mypy repository
  • Create tiny module mypy.x that generates an error: echo '1 + ""' > mypy/x.py
  • Run mypy -i mypy
    • This takes a while, generates an error for mypy/x.py as expected
  • Run mypy -i mypy
    • This is as slow as the previous run, but caching should make this much faster

Activity

  1. JukkaL commented on Oct 19, 2017

    @JukkaL
    CollaboratorAuthor

    @gvanrossum in #4130 (comment):

    The performance problem is apparently not new -- I can reproduce this with standard -i mode as well. No cache entries for the mypy package are written somehow -- perhaps because mypy.x precedes all other submodules of mypy. This could be due to an edge case in the topsort.

  2. gvanrossum commented on Nov 7, 2017

    @gvanrossum
    Member

    Adding topic-daemon label because this impedes one of the important use cases for the daemon (quickly rechecking code with errors).

  3. JukkaL commented on Nov 17, 2017

    @JukkaL
    CollaboratorAuthor

    This is blocking progress in fine-grained incremental mode. ASTs can't be reused when there is an error. In fine-grained incremental mode we want to cache every module that has no blocking errors. I'll try to fix or work around this.

  4. JukkaL commented on Nov 20, 2017

    @JukkaL
    CollaboratorAuthor

    I've worked around this in my local branch (but have not fixed the underlying issue).

  5. self-assigned this
    on Dec 1, 2017
  6. gvanrossum commented on Dec 6, 2017

    @gvanrossum
    Member

    I've got a clue about why this is happening: in build.py, in State.write_cache(), on line 1943, there's a check for self.manager.errors.is_errors(). But this returns True when there was an error in any previous file! And then two lines down we actually call delete_cache(). (This was added recently in PR #4045.)

    What we actually need is a little different -- we want to check if the current SCC or any of its dependents has errors.

  7. added 3 commits that reference this issue on Dec 6, 2017
    5c8e6fb
    26bd4f6
    70611e0
  8. added a commit that references this issue on Dec 8, 2017
    01de89f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions