Skip to content

perf(codegen): use isize for quote counters#13441

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-30-perf_codegen_use_isize_for_quote_counters
Aug 31, 2025
Merged

perf(codegen): use isize for quote counters#13441
graphite-app[bot] merged 1 commit intomainfrom
08-30-perf_codegen_use_isize_for_quote_counters

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Aug 30, 2025

Small perf optimization for codegen when running in WASM. Use isize instead of i64 for quote cost counters. isize is sufficient to prevent overflow, and is a single "word" in 32-bit WASM.

@github-actions github-actions bot added A-codegen Area - Code Generation C-performance Category - Solution not expected to change functional behavior, only performance labels Aug 30, 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.

@overlookmotel overlookmotel marked this pull request as ready for review August 30, 2025 16:52
Copilot AI review requested due to automatic review settings August 30, 2025 16:52
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 optimizes performance in the codegen module for WASM environments by changing quote counter variables from i64 to isize. This is a targeted optimization that reduces memory usage and improves performance on 32-bit WASM where isize is a single word rather than requiring 64-bit arithmetic.

  • Changed quote cost counter variables from i64 to isize in two functions
  • Updated comments to clarify maximum string length constraints on different platforms
  • Maintained overflow prevention while optimizing for 32-bit WASM performance

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 30, 2025

CodSpeed Instrumentation Performance Report

Merging #13441 will not alter performance

Comparing 08-30-perf_codegen_use_isize_for_quote_counters (39fc0d6) with main (9c3b060)1

Summary

✅ 37 untouched benchmarks

Footnotes

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

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

Boshen commented Aug 31, 2025

Merge activity

Small perf optimization for codegen when running in WASM. Use `isize` instead of `i64` for quote cost counters. `isize` is sufficient to prevent overflow, and is a single "word" in 32-bit WASM.
@graphite-app graphite-app bot force-pushed the 08-30-perf_codegen_use_isize_for_quote_counters branch from 6cf572a to 39fc0d6 Compare August 31, 2025 05:27
@graphite-app graphite-app bot merged commit 39fc0d6 into main Aug 31, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 08-30-perf_codegen_use_isize_for_quote_counters branch August 31, 2025 05:32
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation 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