Speed up core loop a bit by caching ids