Track obj -> id map separately to improve performance.

This hugely speeds up the ics writing, from 60s in id_assign to <<1s.

Thomas thinks it warrants a separate class, I would skip it, too.