AMP reduce_by_key optimization changes