Skip to content

Decrease number of allocations in new test #115887

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

Merged
merged 1 commit into from
May 22, 2025

Conversation

jakobbotsch
Copy link
Member

Otherwise the test runs very slowly under DOTNET_GCStress=1/3, as @LuckyXu-HF points out in #115827 (comment).

This still catches the original issue under GCStress=c.

Otherwise the test runs very slowly under DOTNET_GCStress=1/3.
@Copilot Copilot AI review requested due to automatic review settings May 22, 2025 11:28
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 22, 2025
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

@Copilot 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 reduces the memory footprint of the Runtime_115815 test by cutting down its array size and compensating with extra loop iterations to maintain the original work count, which speeds up runs under GCStress.

  • Shrinks the destination array from 1,000,000 to 1,000 elements to lower allocations.
  • Adjusts the loop to run Length * 1000 times, using i / 1000 to write into the smaller array.
Comments suppressed due to low confidence (2)

src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.cs:14

  • [nitpick] Extract the 1_000 magic number into a named constant (e.g. ArraySize) to clarify its purpose and make future adjustments easier.
var destination = new KeyValuePair<Container, double>[1_000];

src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.cs:17

  • [nitpick] Consider defining IterationsPerSlot = 1000 as a constant and using it in both the loop bound and the index calculation to avoid repeating the same literal.
for (int i = 0; i < destination.Length * 1000; i++)

@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib

@jakobbotsch jakobbotsch requested a review from a team May 22, 2025 11:30
@jakobbotsch
Copy link
Member Author

/ba-g Test-only change

@jakobbotsch jakobbotsch merged commit 49baf1d into dotnet:main May 22, 2025
71 of 73 checks passed
@jakobbotsch jakobbotsch deleted the decrease-new-test-allocs branch May 22, 2025 14:41
SimaTian pushed a commit that referenced this pull request May 27, 2025
Otherwise the test runs very slowly under DOTNET_GCStress=1/3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants