-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Optmize ContextN putAllInto #3446
Labels
Milestone
Comments
reactorbot
added
the
❓need-triage
This issue needs triage, hasn't been looked at by a team member yet
label
Apr 25, 2023
OlegDokuka
added
type/enhancement
A general enhancement
area/context
This issue is related to the Context
and removed
❓need-triage
This issue needs triage, hasn't been looked at by a team member yet
labels
Apr 25, 2023
koo-taejin
added a commit
to koo-taejin/reactor-core
that referenced
this issue
Apr 25, 2023
koo-taejin
added a commit
to koo-taejin/reactor-core
that referenced
this issue
Apr 25, 2023
koo-taejin
added a commit
to koo-taejin/reactor-core
that referenced
this issue
Apr 26, 2023
koo-taejin
added a commit
to koo-taejin/reactor-core
that referenced
this issue
May 8, 2023
koo-taejin
added a commit
to koo-taejin/reactor-core
that referenced
this issue
May 22, 2023
koo-taejin
added a commit
to koo-taejin/reactor-core
that referenced
this issue
May 23, 2023
fixed with #3448 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Hello.
Motivation
I often use Coroutines and Reactors together.
To use these two together
I often use the
Await.kt
fromhttps://github.com/Kotlin/kotlinx.coroutines
Unfortunately, there are performance issues.
Extract the ReactorContext from
Await.kt
.Publisher has the extracted ReactorContext, and Subscriber has an empty ReactorContext because it creates a new one.
And finally combine these two ReactorContext in
reactor.util.context.ContextN#putAllInto
.In my case, I always have 20 to 30 ReactorContexts.
In this case, base is empty, so the code below runs.
If this code assumes that there are 20 contexts like me, many Contexts will be created.
In addition, because the previous value is copied again
To create ContextN, my application has to copy a lot.
Desired solution
Considered alternatives
Additional context
PR : #3445
If you change this part like the changed code, resource usage can be reduced.
Anyway, since
this
is alreadyContextN
, the result will be made into ContextN.Only the number of Contexts will be copied, and Context objects are created only once, so it is judged that it will be possible to save resources much more than before.
Below is the code comparing when base is ContextN or not.
When running with AsyncProfiler individual tests on my MACBook
CPU
Memory Allocation
Thanks :)
The text was updated successfully, but these errors were encountered: