Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactor quickstart command and add quickstress command
  • Loading branch information
Geoffrey Broadwell committed Oct 29, 2014
1 parent 7ded32e commit 80d904e
Showing 1 changed file with 65 additions and 26 deletions.
91 changes: 65 additions & 26 deletions bench
Expand Up @@ -19,8 +19,70 @@ init_bench_handling();
# NOTE: The quickstart command is first here so it will appear first
# in the help text and hopefully catch the user's eye

#| Setup, build, and test default compilers
#| Setup, build, benchmark, and compare default compilers
multi MAIN ('quickstart', Str :$stop-after = '') {
my sub checkouts() {
my @compilers = < perl5 nqp-moar rakudo-moar >;
my @extras = < nqp-moar/master rakudo-moar/nom >;
my sub good-tag($tag) {
$tag ~~ /^ \d**4\.\d**2 $/ && $tag ge '2014.01'
|| $tag ~~ /^ 'v5.'(\d+)\.(\d+) $/ && +$0 >= 18 && +$0 %% 2
}

guess-checkouts(:@compilers, :@extras, :&good-tag);
}

my @checkouts = quickprep(:$stop-after, :&checkouts);
return unless @checkouts;

say "\nRUN BENCHMARKS";
MAIN('time', @checkouts);
return if $stop-after eq 'time';

say "\nPERFORMANCE HISTORY";
MAIN('history', @checkouts);
}

#| Setup, build, stress test, and diagnose default compilers
multi MAIN ('quickstress', Str :$stop-after = '') {
my sub checkouts() {
my @compilers = < rakudo-moar rakudo-jvm >;
my @extras = < rakudo-moar/nom rakudo-jvm/nom >;
my sub good-tag($tag) {
$tag ~~ /^ \d**4\.\d**2 $/ && $tag ge '2014.01'
}

guess-checkouts(:@compilers, :@extras, :&good-tag);
}

my @checkouts = quickprep(:$stop-after, :&checkouts);
return unless @checkouts;

say "\nRUN STRESS TESTS";
MAIN('stress', @checkouts);
return if $stop-after eq 'stress';

say "\nDIAGNOSE FAILURES";
MAIN('diagnose', @checkouts);
}

#| Figure out which tags to build and test by default
sub guess-checkouts(:@compilers, :@extras, :&good-tag) {
my %tags := known-tags(@compilers);

my %default;
%default{$_} = %tags{$_}.grep(&good-tag) for @compilers;

sort gather {
for %default.kv -> $compiler, @defaults {
take "$compiler/$_" for @defaults;
}
.take for @extras;
}
}

#| Setup and build compilers
sub quickprep(Str :$stop-after, :&checkouts) {
say "CONFIGURATION";
MAIN('config');
return if $stop-after eq 'config';
Expand All @@ -33,29 +95,11 @@ multi MAIN ('quickstart', Str :$stop-after = '') {
MAIN('fetch');
return if $stop-after eq 'fetch';

# Figure out which tags to build and test by default
my @compilers = < perl5 nqp-moar rakudo-moar >;
my %tags := known-tags(@compilers);

my sub modern-release($tag) {
$tag ~~ /^ \d**4\.\d**2 $/ && $tag ge '2014.01'
|| $tag ~~ /^ 'v5.'(\d+)\.(\d+) $/ && +$0 >= 18 && +$0 %% 2
}
my %default;
%default{$_} = %tags{$_}.grep(&modern-release) for @compilers;

%default<nqp-moar>.push: 'master';
%default<rakudo-moar>.push: 'nom';

my @checkouts = gather for %default.kv -> $compiler, @defaults {
take "$compiler/$_" for @defaults;
}

say "\nPLANNED CHECKOUTS";
my @checkouts = checkouts();
.say for @checkouts;
return if $stop-after eq 'plan';

# Extract, build, time, and compare the default checkouts
say "\nEXTRACT CHECKOUTS";
MAIN('extract', @checkouts);
return if $stop-after eq 'extract'|'checkout';
Expand All @@ -64,12 +108,7 @@ multi MAIN ('quickstart', Str :$stop-after = '') {
MAIN('build', @checkouts);
return if $stop-after eq 'build';

say "\nRUN BENCHMARKS";
MAIN('time', @checkouts);
return if $stop-after eq 'time';

say "\nPERFORMANCE HISTORY";
MAIN('history', @checkouts);
return @checkouts;
}

#| Show benchmark configuration
Expand Down

0 comments on commit 80d904e

Please sign in to comment.