Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jul 25, 2025

Program is always the first node in AstNodes, so no need to store a duplicate &Program reference in AstNodes.

I think this is an improvement. It does make AstNodes::program marginally more expensive, because it now has 2 checks:

  1. Check AstNodes::nodes is not empty. and
  2. Check that first AST node is Program.

But both checks are branches which are never taken, so pretty cheap, and both checks share a single panic. So overall, I think it's probably better than AstNodes being larger than it otherwise needs to be.

@github-actions github-actions bot added A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jul 25, 2025
Copy link
Member Author

overlookmotel commented Jul 25, 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 25, 2025

CodSpeed Instrumentation Performance Report

Merging #12516 will not alter performance

Comparing 07-25-refactor_semantic_remove_astnodes_program_field (8912134) with main (5a7e72a)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on main (75d592f) during the generation of this report, so 5a7e72a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel marked this pull request as ready for review July 25, 2025 12:04
@overlookmotel overlookmotel requested a review from Dunqing as a code owner July 25, 2025 12:04
@graphite-app graphite-app bot changed the base branch from 07-25-refactor_semantic_astnodes_program_return_program_not_option_program_ to graphite-base/12516 July 25, 2025 12:06
@overlookmotel overlookmotel marked this pull request as draft July 25, 2025 12:08
@overlookmotel overlookmotel force-pushed the 07-25-refactor_semantic_remove_astnodes_program_field branch from 7055ecb to 3edb40e Compare July 25, 2025 12:12
@overlookmotel overlookmotel changed the base branch from graphite-base/12516 to 07-25-refactor_semantic_astnodes_program_return_program_not_option_program_ July 25, 2025 12:13
@overlookmotel overlookmotel marked this pull request as ready for review July 25, 2025 12:13
Base automatically changed from 07-25-refactor_semantic_astnodes_program_return_program_not_option_program_ to main July 25, 2025 12:14
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jul 25, 2025
Copy link
Contributor

camc314 commented Jul 25, 2025

Merge activity

`Program` is always the first node in `AstNodes`, so no need to store a duplicate `&Program` reference in `AstNodes`.

I *think* this is an improvement. It does make `AstNodes::program` marginally more expensive, because it now has 2 checks:

1. Check `AstNodes::nodes` is not empty. and
2. Check that first AST node is `Program`.

But both checks are branches which are never taken, so pretty cheap, and both checks share a single panic. So overall, I think it's probably better than `AstNodes` being larger than it otherwise needs to be.
@graphite-app graphite-app bot force-pushed the 07-25-refactor_semantic_remove_astnodes_program_field branch from 3edb40e to 8912134 Compare July 25, 2025 12:41
@graphite-app graphite-app bot merged commit 8912134 into main Jul 25, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 07-25-refactor_semantic_remove_astnodes_program_field branch July 25, 2025 12:49
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-semantic Area - Semantic 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.

3 participants