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

fix(pacmak): greatly reduce go code-gen memory footprint #3362

Merged
merged 2 commits into from Feb 1, 2022

Commits on Feb 1, 2022

  1. fix(pacmak): greatly reduce go code-gen memory footprint

    The go code generator was previously holding multiple copies of the
    `RootModule` objects for dependencies (one for the generated package's
    own `RootModule`, and one for each submodule that uses a type from that
    dependency), including their entire type hierarchy, methods and
    properties.
    
    On large packages, especially with many submodules, this results in an
    extremely large resident set size. Pathological cases have required
    heaps as big as 6 GiB.
    
    De-duplicating the `RootModule` instances, and not retaining `GoTypeRef`
    instances (which are stateless, and cheap to construct), allows reducing
    those pathological modules to only occupy around 300 to 400 MiB worth of
    heap, which is a very significant improvement.
    
    The reduction of duplication also has significant performance benefits
    on affected code-bases. The go bindings generate significantly faster on
    top of needing significantly less memory.
    RomainMuller committed Feb 1, 2022
    Configuration menu
    Copy the full SHA
    ef2d33f View commit details
    Browse the repository at this point in the history
  2. linter fix

    RomainMuller committed Feb 1, 2022
    Configuration menu
    Copy the full SHA
    d310e1e View commit details
    Browse the repository at this point in the history