Optimize IDMapper

Simplify code and remove a whole bunch of redundant copies.

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>