I'm going to guess it would be more efficient to create them before the iteration. But I doubt it would even take milliseconds, even managing to do 1 less database retrieval in your app would probably result in more efficiency gain than refactoring stuff like this.