Skip to content
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

Improve collided exception performance #100169

Merged
merged 6 commits into from
Mar 28, 2024

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Mar 23, 2024

With the new EH enabled, one exception handling performance test has regressed while all other improved dramatically. I have investigated the test case and it turned out that the regression is due to the way we unwind during second pass when we have an exception that occured in a catch or finally funclet call chain and escaped it. What we do is that we unwind stack until we reach the parent stack frame of the catch / finally and then continue searching for handlers. The NativeAOT that the new EH is based on doesn't unwind stack though, it just moves the current stack frame iterator to the position of the previous exception's stack frame iterator by copying its state. I have applied the same mechanism to the new EH in coreclr and it improved the performance of that test 3-4 times on my machine.

Close #99965

With the new EH enabled, one exception handling performance test has
regressed while all other improved dramatically. I have investigated the
test case and it turned out that the regression is due to the way we
unwind during second pass when we have an exception that occured in a
catch or finally funclet call chain and escaped it.
What we do is that we unwind stack until we reach the parent stack frame
of the catch / finally and then continue searching for handlers.
The NativeAOT that the new EH is based on doesn't unwind stack though,
it just moves the current stack frame iterator to the position of the
previous exception's stack frame iterator by copying its state.
I have applied the same mechanism to the new EH in coreclr and it
improved the performance of that test 3-4 times on my machine.
@janvorli janvorli added this to the 9.0.0 milestone Mar 23, 2024
@janvorli janvorli self-assigned this Mar 23, 2024
@janvorli
Copy link
Member Author

/azp run runtime-coreclr gcstress0x3-gcstress0xc

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@janvorli
Copy link
Member Author

/azp run runtime-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@janvorli janvorli force-pushed the improve-collided-exception-performance branch from 35c8a4e to add6b2f Compare March 26, 2024 16:38
@janvorli janvorli force-pushed the improve-collided-exception-performance branch from 790fa1c to 17dab65 Compare March 26, 2024 21:14
@janvorli
Copy link
Member Author

/azp run runtime-coreclr outerloop

@janvorli
Copy link
Member Author

/azp run runtime-coreclr gcstress0x3-gcstress0xc

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@janvorli
Copy link
Member Author

/azp run runtime-coreclr gcstress0x3-gcstress0xc outerloop

Copy link

No pipelines are associated with this pull request.

@janvorli
Copy link
Member Author

/azp run runtime-coreclr gcstress0x3-gcstress0xc

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@janvorli
Copy link
Member Author

/azp run runtime-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@janvorli janvorli requested a review from jkotas March 27, 2024 18:31
@janvorli janvorli removed the NO-REVIEW Experimental/testing PR, do NOT review it label Mar 27, 2024
@janvorli
Copy link
Member Author

The arm gc stress issue is known - see #99410

@janvorli janvorli merged commit ccc2d3b into dotnet:main Mar 28, 2024
92 checks passed
@janvorli janvorli deleted the improve-collided-exception-performance branch March 28, 2024 00:45
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Perf] Windows/x64: 2 Regressions on 3/16/2024 1:13:28 AM
2 participants