Hey Welly,

If you call filter and map one after the other like you mentioned, these
operators will be chained and executed as if they were running in the same
operator.
The only small performance overhead comes from the fact that the output of
the filter will be copied before passing it as input to the map to keep
immutability guarantees (but no serialization/deserialization will happen).
Copying might be practically free depending on your data type, though.

If you are using operators that don't make use of the immutability of
inputs/outputs (i.e you don't hold references to those values) than you can
disable copying altogether by calling env.getConfig().enableObjectReuse(),
in which case they will have exactly the same performance.

Cheers,
Gyula

Welly Tambunan <if05...@gmail.com> ezt írta (időpont: 2015. szept. 3., Cs,
4:33):

> Hi All,
>
> I would like to filter some item from the event stream. I think there are
> two ways doing this.
>
> Using the regular pipeline filter(...).map(...). We can also use flatMap
> for doing both in the same operator.
>
> Any performance improvement if we are using flatMap ? As that will be done
> in one operator instance.
>
>
> Cheers
>
>
> --
> Welly Tambunan
> Triplelands
>
> http://weltam.wordpress.com
> http://www.triplelands.com <http://www.triplelands.com/blog/>
>

Reply via email to