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

refactor(ast): generate Visit methods in order of type definitions #8891

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Feb 4, 2025

Pure refactor. Re-order the methods in generated Visit and VisitMut traits to be in same order they appear in source code.

This simplifies and improves performance of the codegen considerably. Previously it walked the AST types recursively, with loads of checks "did I generate visitor for this type already?". Now it's just a single loop over the type definitions.

I've double-checked that this does not result in new/missing visit methods. This change purely results in the same methods being output in a different order.

This was referenced Feb 4, 2025
Copy link
Contributor Author

overlookmotel commented Feb 4, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-ast Area - AST A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Feb 4, 2025
Copy link

codspeed-hq bot commented Feb 4, 2025

CodSpeed Performance Report

Merging #8891 will not alter performance

Comparing 02-04-refactor_ast_generate_visit_methods_in_order_of_type_definitions (a36bc5f) with 02-04-refactor_ast_name_astbuilder_enum_builders_after_variant_name_not_type_name (bbb075d)

Summary

✅ 33 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review February 4, 2025 11:15
Copy link

graphite-app bot commented Feb 4, 2025

Merge activity

@graphite-app graphite-app bot added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Feb 4, 2025
…8891)

Pure refactor. Re-order the methods in generated `Visit` and `VisitMut` traits to be in same order they appear in source code.

This simplifies and improves performance of the codegen considerably. Previously it walked the AST types recursively, with loads of checks "did I generate visitor for this type already?". Now it's just a single loop over the type definitions.

I've double-checked that this does not result in new/missing visit methods. This change purely results in the same methods being output in a different order.
@graphite-app graphite-app bot force-pushed the 02-04-refactor_ast_name_astbuilder_enum_builders_after_variant_name_not_type_name branch from c46048a to bbb075d Compare February 4, 2025 22:34
@graphite-app graphite-app bot force-pushed the 02-04-refactor_ast_generate_visit_methods_in_order_of_type_definitions branch from d0bab30 to a36bc5f Compare February 4, 2025 22:34
Base automatically changed from 02-04-refactor_ast_name_astbuilder_enum_builders_after_variant_name_not_type_name to main February 4, 2025 22:59
@graphite-app graphite-app bot merged commit a36bc5f into main Feb 4, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 02-04-refactor_ast_generate_visit_methods_in_order_of_type_definitions branch February 4, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-ast Area - AST A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant