C:\test>587072 -N=10 -KEYS=a,b dispatch => # line 1 "dispatch.pl" my $x += ( $dispatch{ $_ } ||= $dispatch{ default } ) for @data; ifelse => # line 1 "ifelse.pl" for( @data ) { if( $_ eq "a" ) { my $x = $dispatch{ a } } elsif( $_ eq "b" ) { my $x = $dispatch{ b } } else{ my $x = $dispatch{ default } } } Rate ifelse dispatch ifelse 39306/s -- -29% dispatch 55351/s 41% -- #### C:\test>587072 -N=10 -KEYS=a,b dispatch => # line 1 "dispatch.pl" my $x += ( $dispatch{ $_ } ||= $dispatch{ default } )->() for @data; ifelse => # line 1 "ifelse.pl" for( @data ) { if( $_ eq "a" ) { my $x = $dispatch{ a }->() } elsif( $_ eq "b" ) { my $x = $dispatch{ b }->() } else{ my $x = $dispatch{ default }->() } } Rate ifelse dispatch ifelse 21966/s -- -15% dispatch 25880/s 18% -- C:\test>587072 -N=10 -KEYS=a,b,c dispatch => # line 1 "dispatch.pl" my $x += ( $dispatch{ $_ } ||= $dispatch{ default } )->() for @data; ifelse => # line 1 "ifelse.pl" for( @data ) { if( $_ eq "a" ) { my $x = $dispatch{ a }->() } elsif( $_ eq "b" ) { my $x = $dispatch{ b }->() } elsif( $_ eq "c" ) { my $x = $dispatch{ c }->() } else{ my $x = $dispatch{ default }->() } } Rate ifelse dispatch ifelse 16250/s -- -22% dispatch 20798/s 28% -- #### C:\test>587072 -N=10 -KEYS=a,b,c,d,e,f,g dispatch => # line 1 "dispatch.pl" my $x += ( $dispatch{ $_ } ||= $dispatch{ default } )->() for @data; ifelse => # line 1 "ifelse.pl" for( @data ) { if( $_ eq "a" ) { my $x = $dispatch{ a } } elsif( $_ eq "b" ) { my $x = $dispatch{ b } } elsif( $_ eq "c" ) { my $x = $dispatch{ c } } elsif( $_ eq "d" ) { my $x = $dispatch{ d } } elsif( $_ eq "e" ) { my $x = $dispatch{ e } } elsif( $_ eq "f" ) { my $x = $dispatch{ f } } elsif( $_ eq "g" ) { my $x = $dispatch{ g } } else{ my $x = $dispatch{ default } } } Rate dispatch ifelse dispatch 10511/s -- -8% ifelse 11428/s 9% -- C:\test>587072 -N=10 -KEYS=a,b,c,d,e,f,g,h dispatch => # line 1 "dispatch.pl" my $x += ( $dispatch{ $_ } ||= $dispatch{ default } )->() for @data; ifelse => # line 1 "ifelse.pl" for( @data ) { if( $_ eq "a" ) { my $x = $dispatch{ a } } elsif( $_ eq "b" ) { my $x = $dispatch{ b } } elsif( $_ eq "c" ) { my $x = $dispatch{ c } } elsif( $_ eq "d" ) { my $x = $dispatch{ d } } elsif( $_ eq "e" ) { my $x = $dispatch{ e } } elsif( $_ eq "f" ) { my $x = $dispatch{ f } } elsif( $_ eq "g" ) { my $x = $dispatch{ g } } elsif( $_ eq "h" ) { my $x = $dispatch{ h } } else{ my $x = $dispatch{ default } } } Rate dispatch ifelse dispatch 9558/s -- -1% ifelse 9635/s 1% -- C:\test>587072 -N=10 -KEYS=a,b,c,d,e,f,g,h,i dispatch => # line 1 "dispatch.pl" my $x += ( $dispatch{ $_ } ||= $dispatch{ default } )->() for @data; ifelse => # line 1 "ifelse.pl" for( @data ) { if( $_ eq "a" ) { my $x = $dispatch{ a } } elsif( $_ eq "b" ) { my $x = $dispatch{ b } } elsif( $_ eq "c" ) { my $x = $dispatch{ c } } elsif( $_ eq "d" ) { my $x = $dispatch{ d } } elsif( $_ eq "e" ) { my $x = $dispatch{ e } } elsif( $_ eq "f" ) { my $x = $dispatch{ f } } elsif( $_ eq "g" ) { my $x = $dispatch{ g } } elsif( $_ eq "h" ) { my $x = $dispatch{ h } } elsif( $_ eq "i" ) { my $x = $dispatch{ i } } else{ my $x = $dispatch{ default } } } Rate ifelse dispatch ifelse 8092/s -- -6% dispatch 8566/s 6% --