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

Treewalker: Improve performance by avoiding memory allocations #309

Merged
merged 3 commits into from
Jan 29, 2024

Commits on Jan 27, 2024

  1. Treewalker: Improve performance by avoiding memory allocations

    Previously the treewalker would unnecessary call "to_h" on each Protobuf
    message in the parsetree, in order to get the field names to walk. This
    caused unnecessary copies of the message, increasing memory usage and
    slowing down the tree walk. Instead, use the Protobuf descriptor and its
    field descriptors to walk the message.
    
    Additionally this also optimizes the case where a block with 1 argument
    is used for the tree walk, since we don't need to handle the location,
    avoiding unnecessary copies of the field name string.
    
    Together these changes result in about a 5x speed up in some use cases.
    lfittl committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    71638a3 View commit details
    Browse the repository at this point in the history
  2. Update lib/pg_query/treewalker.rb

    Co-authored-by: Olle Jonsson <[email protected]>
    lfittl and olleolleolle authored Jan 27, 2024
    Configuration menu
    Copy the full SHA
    7b7bad9 View commit details
    Browse the repository at this point in the history
  3. Apply review feedback

    lfittl committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    abc073e View commit details
    Browse the repository at this point in the history