optimization: fewer getInfoForFile() calls