in reply to Loops loosing Performance

Yet another way to do it. Somewhat slower and less arcane than kaif's, but maybe adaptable to other situations. And it saves a few keystrokes. :-)
# Reused your sub name sub test4 { return unpack("%4b*", pack('C', $_[0] & $_[1])); } __END__ Rate Test5 Test4 Test0 Test5 88345/s -- -34% -47% Test4 133240/s 51% -- -20% Test0 167395/s 89% 26% --

Caution: Contents may have been coded under pressure.