in reply to map vs for\foreach.

Don't "diddle" code to make it faster: find a better algorithm."

-- Kernighan & Plauger, The Elements of Programming Style.