Help for this page

Select Code to Download


  1. or download this
    use Modern::Perl;
    
    ...
        my @big   = split ':', $_[1];
        @small ~~ [ grep $_ ~~ @big, @small ];
    }
    
  2. or download this
    sub isSubset {
        my $count = my @small = split ':', $_[0];
    ...
        do { $count-- when @big } for @small;
        !$count;
    }
    
  3. or download this
    use Modern::Perl;
    use Benchmark qw(cmpthese);
    ...
            isSubsetHash    => sub { say isSubsetHash( $b, $a ) },
        }
    );
    
  4. or download this
                        Rate      isSubset    isSubsetHash isSubsetSmarter
    isSubset        143452/s            --            -15%            -54%
    isSubsetHash    169263/s           18%              --            -45%
    isSubsetSmarter 309705/s          116%             83%              --