in reply to Interleaving bytes in a string quickly

This is slightly faster on my computer:
$s = time; $out1 = chr(0) x 2e6; substr($out1, $_ * 2, 1, substr($buf, $_, 1)) for 0..1e6; print time() - $s, "\n";