-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
base: series/2.x
Are you sure you want to change the base?
Optimize Scope finalization for empty scopes #9477
Conversation
Co-authored-by: Jules Ivanic <jules.ivanic@gmail.com>
case Exit.Failure(c) if error eq null => error = c | ||
case Exit.Failure(c) => error = error ++ c |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 _ => ()
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