Optimize object iteration in forEach

(as per @creationix's feedback)