Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalidate methods when binding is typed/const-defined #54733

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jun 7, 2024

  1. Invalidate methods when binding is typed/const-defined

    This allows for patterns like:
    ```
    julia> function foo(N)
        for i = 1:N
            x = bar(i)
        end
    end
    
    julia> foo(1_000_000_000)
    ERROR: UndefVarError: `bar` not defined
    ```
    
    not to suffer a tremendous performance regression because of the fact
    that `foo` was inferred with `bar` still undefined.
    
    Strictly speaking the original code remains valid, but for performance
    reasons once the global is defined we'd like to invalidate the code
    anyway to get an improved inference result.
    
    ```
    julia> bar(x) = 3x
    bar (generic function with 1 method)
    
    julia> foo(1_000_000_000) # w/o PR: takes > 30 seconds
    ```
    topolarity committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    6e90c55 View commit details
    Browse the repository at this point in the history