I recall this … not perfect but it could help http://forum.mikrotik.com/t/how-to-opitimize-list-of-ip4-addresses/129916/1