lib: improved forEach object performance