Skip to content

feat(tasks): track allocations for semantic#13012

Closed
camchenry wants to merge 1 commit intomainfrom
08-12-feat_tasks_track_allocations_for_semantic
Closed

feat(tasks): track allocations for semantic#13012
camchenry wants to merge 1 commit intomainfrom
08-12-feat_tasks_track_allocations_for_semantic

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Aug 12, 2025

Now that we've tested the allocation tracking for parsing for a while and it has been fairly stable, I'd like to start tracking allocations for Semantic as well. Tracking the arena allocations for semantic is non-trivial unfortunately due to the usage of the allocator internally. Once we can supply an allocator to SemanticBuilder it will be easy to start tracking allocations.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Aug 12, 2025
Copy link
Member Author

camchenry commented Aug 12, 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 Aug 12, 2025

CodSpeed Instrumentation Performance Report

Merging #13012 will not alter performance

Comparing 08-12-feat_tasks_track_allocations_for_semantic (b2a534c) with main (1385c71)1

Summary

✅ 34 untouched benchmarks

Footnotes

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

@overlookmotel
Copy link
Member

Number of arena reallocations happening in SemanticBuilder could be really interesting here.

Semantic uses a separate Allocator. You'd need to get access to it somehow to find out how many allocations it makes.

@camchenry camchenry force-pushed the 08-12-feat_tasks_track_allocations_for_semantic branch from 5f2d010 to 62f2cc4 Compare August 12, 2025 19:23
@camchenry
Copy link
Member Author

Number of arena reallocations happening in SemanticBuilder could be really interesting here.

Semantic uses a separate Allocator. You'd need to get access to it somehow to find out how many allocations it makes.

It looks like this would be a pretty non-trivial change. I think we'd need to update the public API to match Parser where it accepts an allocator reference and stores it internally? For now, I'm just going to set this up to track system allocations for now so we at least have some information available.

@camchenry camchenry marked this pull request as ready for review August 12, 2025 19:45
Copilot AI review requested due to automatic review settings August 12, 2025 19:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds allocation tracking for the Semantic analyzer to the memory allocation tracking task, extending the existing parser allocation tracking functionality.

  • Introduces semantic analysis allocation tracking alongside the existing parser tracking
  • Refactors the code to support tracking both parser and semantic operations separately
  • Creates separate snapshot files for parser and semantic allocation statistics

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
tasks/track_memory_allocations/src/lib.rs Adds semantic tracking logic, refactors stats collection into reusable functions, and creates separate output for parser vs semantic allocations
tasks/track_memory_allocations/allocs_semantic.snap New snapshot file containing semantic allocation statistics
tasks/track_memory_allocations/Cargo.toml Adds oxc_semantic dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@camchenry camchenry force-pushed the 08-12-feat_tasks_track_allocations_for_semantic branch from 62f2cc4 to b2a534c Compare August 14, 2025 01:08
@camchenry camchenry marked this pull request as draft August 30, 2025 00:44
@camchenry
Copy link
Member Author

Going to close for now and will revisit at a later point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants