We need to create a reverse index topic -> subscription for adequate complexity. Even ruling out topics we are not interested in at all (none of the filters have them) can speedup things dramatically, and upon match we can do a more rigorous topic/statement match inspection. There are likely even better ways out there.
Currently it's n_statements x n_filters x n_topics_in_filter x n_topics_in_statement ...
We can merge for now, but should definitely address this in a follow up. Synchronous processing here can also stall the processing of other RPC methods..
Originally posted by @dmitry-markin in #3127 (comment)