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

inference: revive CachedMethodTable mechanism #46535

Merged
merged 1 commit into from
Aug 31, 2022
Merged

inference: revive CachedMethodTable mechanism #46535

merged 1 commit into from
Aug 31, 2022

Commits on Aug 30, 2022

  1. inference: revive CachedMethodTable mechanism

    `CachedMethodTable` was removed within #44240 as we couldn't confirm any
    performance improvement then. However it turns out the optimization was
    critical in some real world cases (e.g. #46492), so this commit revives
    the mechanism with the following tweaks that should make it more effective:
    - create method table cache per inference (rather than per local
      inference on a function call as on the previous implementation)
    - only use cache mechanism for abstract types (since we already cache
      lookup result at the next level as for concrete types)
    
    As a result, the following snippet reported at #46492 recovers the
    compilation performance:
    ```julia
    using ControlSystems
    a_2 = [-5 -3; 2 -9]
    C_212 = ss(a_2, [1; 2], [1 0; 0 1], [0; 0])
    @time norm(C_212)
    ```
    
    > on master
    ```
    julia> @time norm(C_212)
    364.489044 seconds (724.44 M allocations: 92.524 GiB, 6.01% gc time, 100.00% compilation time)
    0.5345224838248489
    ```
    
    > on this commit
    ```
    julia> @time norm(C_212)
     26.539016 seconds (62.09 M allocations: 5.537 GiB, 5.55% gc time, 100.00% compilation time)
    0.5345224838248489
    ```
    aviatesk committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    2d05615 View commit details
    Browse the repository at this point in the history