MonoSubscriber.discard Performance issues ?
do not call Operators.onDiscard when the v is null ?
probably it can be onDiscard optimization since now it is
Consumer<Object> hook = context.getOrDefault(Hooks.KEY_ON_DISCARD, null);
if (element != null && hook != null) {
try {
hook.accept(element);
}
catch (Throwable t) {
log.warn("Error in discard hook", t);
}
}
but could be
if (element != null) {
Consumer<Object> hook = context.getOrDefault(Hooks.KEY_ON_DISCARD, null);
if (hook != null) {
try {
hook.accept(element);
}
catch (Throwable t) {
log.warn("Error in discard hook", t);
}
}
}
emmm, I think actual.currentContext() is the cause of the problem ?
@zhou-hao that call is inevitable but we can avoid it if we check for null. Alternatively we can cache context within every operator
the method Operators.MonoSubscriber#discard should check for null ?
protected void discard(@Nullable O v) {
Operators.onDiscard(v, actual.currentContext());
}
This issue is a bit dated. I wonder if we should come back to it. @zhou-hao are you still interested in this issue? If so, a reproducible example with a pipeline where this is a problem could serve as a basis for diagnosing and aiming for a better result. Are you able to provide something? Thanks in advance.