memory optimization for api.matchBlocks

matchBlocks now score duplicates in chunks to limit the total memory
required.