You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FluxIndex.onNext(T element) inadvertently calls element.toString() in order to create sensible error message when calling Objects.requireNonNull. This can cause performance issue if element.toString() is an expensive operation.
Defer the creation of the error message when it is really needed (ie when indexMapper.apply() returns null).
This applies to FluxIndexFusable as well.
Reactor Core version
3.2.3
The text was updated successfully, but these errors were encountered:
… lazy
Due to use of Objects.requireNonNull(Object, String) varaiant, toString for each element that was passing through the operator was evaluated eagerly. To change that used Objects.requireNonNull(Object, Supplier<String>) varaiant which makes toString call lazy. Only if indexMapper.apply() will return null, then the toString will be called.
npathai
added a commit
to npathai/reactor-core
that referenced
this issue
Dec 4, 2018
… lazy
Rather than using Supplier<String> variant of Objects.requireNonNull() which would have created Supplier instances unnecessarily, used traditional null check. As the check for null safe index mapping was repeated thrice in FluxIndex, created a NullSafeIndexMapper class which wraps actual indexMapper and provides null safe check. NullSafeIndexMapper instance is created once from the constructor.
FluxIndex.onNext(T element)
inadvertently callselement.toString()
in order to create sensible error message when callingObjects.requireNonNull
. This can cause performance issue ifelement.toString()
is an expensive operation.Defer the creation of the error message when it is really needed (ie when
indexMapper.apply()
returns null).This applies to
FluxIndexFusable
as well.Reactor Core version
3.2.3
The text was updated successfully, but these errors were encountered: