Sorting algorithms/Quicksort: Difference between revisions

Content added Content deleted
imported>Rcmlz
imported>Rcmlz
Line 8,321: Line 8,321:


<syntaxhighlight lang="raku" line>
<syntaxhighlight lang="raku" line>
## run benchmark on the two versions
my $elem-length = 8;
my $elem-length = 8;
my @large of Str = ('a'..'z').roll($elem-length).join xx 10 * $worker * $BATCH-SIZE;
my @large of Str = ('a'..'z').roll($elem-length).join xx 10 * $worker * $BATCH-SIZE;


say "Benchmarking by sorting {@large.elems} strings of size $elem-length - using batches of $BATCH-SIZE strings and $worker workers.";
say "Benchmarking by sorting {@large.elems} strings of size $elem-length - using batches of $BATCH-SIZE strings and $worker workers.";
my @becnhmark = gather
my @benchmark = gather for @implementations -> &fun {
&fun(@large);
for @implementations -> &fun {
take (&fun.name => now - ENTER now);
&fun(@large);
}
take (&fun.name => now - ENTER now);
say @benchmark;
}
say @becnhmark;
</syntaxhighlight>
</syntaxhighlight>
<pre>
<pre>