Store by id not pointer since the pointers are not stable. And use two hash maps by path and by id for fast lookup.