Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.48 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3.  
  4. use Benchmark  qw( cmpthese );
  5. use List::Util qw( any );
  6.  
  7. my %params;
  8.  
  9. my %tests = (
  10.    any  => sub { for (1..1000) { my $x = any  { !$params{$_} } qw( account type sampledate lastpwchange system wspass ); } },
  11.    grep => sub { for (1..1000) { my $x = grep { !$params{$_} } qw( account type sampledate lastpwchange system wspass ); } },
  12. );
  13.  
  14. cmpthese(-3, \%tests);
  15.  
  16. =pod
  17.  
  18.        Rate  any grep
  19. any   473/s   -- -55%
  20. grep 1055/s 123%   --
  21.  
  22. =end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement