optimal way to block long ip:port list

Hi,
Say we have long list of ip:port pairs, with 5,000 - 10,000 items. We need to block all tcp traffic to/from that destinations.
I can only see making long list of either firewall filter, raw or mangle rules. And each ip:port pair will require individual rule. This will be quite messy, but I’m concerned more about performance.
What is an optimal way to do this?