Help for this page

Select Code to Download


  1. or download this
    sub using_str_bit_ops_and_s {
       my ($s1, $s2) = @_;
       (my $mask = $s1) =~ s/[^\x00]/\xFF/g;
       return ($s1 & $mask) | ($s2 & ~$mask);
    }
    
  2. or download this
    sub using_str_bit_ops_and_tr {
       my ($s1, $s2) = @_;
       (my $mask = $s1) =~ tr/\x00/\xFF/c;
       return ($s1 & $mask) | ($s2 & ~$mask);
    }
    
  3. or download this
                Rate    split1   substr1   bit_ops map_split
    split1    1.25/s        --      -95%     -100%     -100%
    substr1   25.5/s     1939%        --      -96%      -99%
    bit_ops    642/s    51313%     2421%        --      -71%
    map_split 2230/s   178496%     8657%      247%        --