I am creating an application that goes through about 400 objects one by one calling functions in a loop. This executes every 10 minutes. When the program is initially started the object properties are collected from a database and then there is no further interaction with the database, until the program terminates and data from the objects is written to the database.

At the moment I am holding these 400 objects in an array in memory and calling and modifying each one at whatever stage in the loop I am at.

I was wondering if there was a more efficient way to do this. Should I keep reading and writing results to the database instead of keeping them in memory or is there another way?