-
-
Save hankache/bbbe41812a1dceb6f6e478ff5228e383 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#No parallel | |
my @array1 = (0..49999); | |
my @array2 = (2..50001); | |
my @result1 = @array1.map( {is-prime($_ + 1)} ); | |
my @result2 = @array2.map( {is-prime($_ - 1)} ); | |
say @result1 == @result2; | |
say now - INIT now; | |
#parallel | |
my @array1 = (0..49999); | |
my @array2 = (2..50001); | |
my $promise1 = start @array1.map( {is-prime($_ + 1)} ); | |
my $promise2 = start @array2.map( {is-prime($_ - 1)} ); | |
my @result1 = await $promise1; | |
my @result2 = await $promise2; | |
say @result1 == @result2; | |
say now - INIT now; |
jonathanstowe
commented
Apr 4, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment