reactivex.github.io
reactivex.github.io copied to clipboard
I am curious about an optimization problem
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