[pl] optimize replacement pairs (40% speedup without much functional change)