SubstMap optimization.

Build arrays for keys and values of symbol substitution, based
on symbol ids (ints) rather than references.