Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jul 31, 2025

Only purpose of function_stack in SemanticBuilder is to track the current function, in order to set NodeFlags::HasYield on it if it contains yield.

#12630 moved enter and exit logic into visit_function. So now we don't need a Stack to track the current function, we can use vars on the actual stack.

Also, it's unnecessary to update current function when entering/exiting arrow functions, as they can't contain yield.

@github-actions github-actions bot added A-semantic Area - Semantic C-performance Category - Solution not expected to change functional behavior, only performance labels Jul 31, 2025
Copy link
Member Author


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 31, 2025

CodSpeed Instrumentation Performance Report

Merging #12676 will not alter performance

Comparing 07-31-perf_semantic_faster_function_stack (2ccf725) with main (5f50bc3)

Summary

✅ 34 untouched benchmarks

@overlookmotel overlookmotel force-pushed the 07-31-perf_semantic_faster_function_stack branch from 8428610 to 71f5e57 Compare July 31, 2025 13:31
@overlookmotel overlookmotel marked this pull request as ready for review July 31, 2025 13:39
@overlookmotel overlookmotel requested a review from Dunqing as a code owner July 31, 2025 13:39
@overlookmotel overlookmotel marked this pull request as draft July 31, 2025 13:40
@overlookmotel overlookmotel force-pushed the 07-31-perf_semantic_faster_function_stack branch from 71f5e57 to 6e07abd Compare July 31, 2025 13:50
@overlookmotel overlookmotel changed the title perf(semantic): faster function stack perf(semantic): remove function stack Jul 31, 2025
@overlookmotel overlookmotel marked this pull request as ready for review July 31, 2025 13:53
Copy link
Member

@Dunqing Dunqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Aug 1, 2025
Copy link
Member

Dunqing commented Aug 1, 2025

Merge activity

Only purpose of `function_stack` in `SemanticBuilder` is to track the current function, in order to set `NodeFlags::HasYield` on it if it contains `yield`.

#12630 moved enter and exit logic into `visit_function`. So now we don't need a `Stack` to track the current function, we can use vars on the actual stack.

Also, it's unnecessary to update current function when entering/exiting arrow functions, as they can't contain `yield`.
@graphite-app graphite-app bot force-pushed the 07-31-perf_semantic_faster_function_stack branch from 6e07abd to 2ccf725 Compare August 1, 2025 09:46
@graphite-app graphite-app bot merged commit 2ccf725 into main Aug 1, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 07-31-perf_semantic_faster_function_stack branch August 1, 2025 09:54
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 1, 2025
graphite-app bot pushed a commit that referenced this pull request Aug 1, 2025
Follow-on after #12676. Fix a typo I introduced in that PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-semantic Area - Semantic C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants