Core: Simplify and speed up .each

Closes gh-1510

(cherry picked from commit eeda11cdd6a69ec2ef4e9c1ed12b82a79910fda5)