reactivex.github.io icon indicating copy to clipboard operation
reactivex.github.io copied to clipboard

I am curious about an optimization problem

Open ASaltedFishBoy opened this issue 5 years ago • 0 comments

I am curious about an optimization problem When a stream is not used directly, will it be compressed to the next stream?

This problem comes from the following code

observable<MessagePtr> getMessage$() { return m_clientChanged$.get_observable ().scan (observable<Message>() , [] (observable<MessagePtr> sendMessage$ , std::pair<Client, bool> client) { if (client.second) { sendMessage$ = sendMessage$.merge (client.first->getMessage$ ()); } else { sendMessage$ = sendMessage$.filter ([ = ] (MessagePtr message) { return message->getMessage ()->getTo () == client.first->getServer (); }); } return sendMessage$; }).switch_on_next(); }

I worry that this code will cause more and more nesting of merge and filter due to the increase of time, causing performance problems

ASaltedFishBoy avatar Jan 17 '20 03:01 ASaltedFishBoy