optimize forEach to read in loop when sync