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

Optimize Scope finalization for empty scopes #9477

Open
wants to merge 5 commits into
base: series/2.x
Choose a base branch
from

Conversation

kyri-petrou
Copy link
Contributor

Added benchmark shows ~50% speedup when closing a scope that doesn't contain any finalizers. This is a quite common case especially when we're forking a scope as the finalizers are usually handled by the child scope

@kyri-petrou kyri-petrou requested a review from guizmaii January 22, 2025 01:58
Comment on lines +336 to +337
case Exit.Failure(c) if error eq null => error = c
case Exit.Failure(c) => error = error ++ c
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do these allocate an option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm not as far as I can tell. Why do you think they might?

Copy link
Contributor

@plokhotnyuk plokhotnyuk Jan 23, 2025

Choose a reason for hiding this comment

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

Can those 2 cases for Exit.Failure be replaces by just one:

case Exit.Failure(c) =>
  error =
    if (error eq null) c
    else error ++ c
case _ => ()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants