Skip to content

Instantly share code, notes, and snippets.

@dwarring
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwarring/12c1e32440a8aea43337 to your computer and use it in GitHub Desktop.
Save dwarring/12c1e32440a8aea43337 to your computer and use it in GitHub Desktop.
Bisection for parrot failures of advent-2010-day14.t etc
# rakudo bisections on parrot
# david warring 15-09-2014
# --------------------------
sub capture-said($code) {
my $output = '';
temp $*OUT = class {
method print(*@args) {
$output ~= @args.join;
}
}
$code();
return $output.lines;
}
my @out = capture-said {say "lah lah lah..." };
my $bisection = 2;
# --- bisection 1 ---
# - this stopped capturing output on parrot
# good: 65db2a6df4ffb08e3eb1d5fc68563ce2dc6c455e
# bad: f97cc9dbe9659d70a0fb41957b1f9bf5682e82b1
say "captured: /{@out}/";
exit( "{@out}" ~~ /lah/ ?? 0 !! 1)
if $bisection == 1;
# -- bisection 2 ---
# hang in capture-said(); statement: return $output.lines
# good: c3bd133cbd86286681dcb0f16cba507d3aecf60b
# bad: 2ad5b8e3e4006b204826424fa48341387ecf6bec
exit;
@dwarring
Copy link
Author

Bisection 1 Result ($ouput.lines empty):
3e96fe51a29fd3758fe774b5e3e95aae9e7196dd is the first bad commit
commit 3e96fe51a29fd3758fe774b5e3e95aae9e7196dd
Author: Elizabeth Mattijsen liz@dijkmat.nl
Date: Tue Sep 9 23:35:24 2014 +0200

Refactor Str.lines to be 2.5x faster & support CR

For /usr/share/dict/words: from 5.786s to 2.268s

With one caveat: strings that have mixed CR and LF line endings, may not come
out correctly.  For that to work reliably, we would need to have nqp::index
support a list of needles to search for.

:040000 040000 77fa452d687f585a5b5d4d770e97c2e43ec86bae 5a2b2bd623d05247110eda8d25f54973bffd7e0c M src
bisect run success

@dwarring
Copy link
Author

Bisection 2 Result ($output.lines hanging on parrot):
df2f8b4954477f02f2481f981a7d7c564a959544 is the first bad commit
commit df2f8b4954477f02f2481f981a7d7c564a959544
Author: Elizabeth Mattijsen liz@dijkmat.nl
Date: Fri Sep 12 12:59:30 2014 +0200

Make Str.lines much simpler, a little faster still

/usr/share/dict/words: 2.383 -> 2.082, about 13%

:040000 040000 3b5860369a482fd16ced846dedc56ea700636af3 0722f61921540008f55746d6814dad3c87066af6 M src
bisect run success

@dwarring
Copy link
Author

Note: Test::plan() [and roast] were broken on parrot for much of the bisections.

I used the above gist and the following shell script to bisect:

#!/bin/bash
echo "running...";
# this wont work across nqp versions
perl Configure.pl --backends=parrot && make && timeout 30s ./perl6-p /tmp/gistfile1.txt;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment