Skip to content

Instantly share code, notes, and snippets.

@timo
Created September 8, 2016 20:51
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 timo/610b39f340db90a4f14eab97c11fa2c3 to your computer and use it in GitHub Desktop.
Save timo/610b39f340db90a4f14eab97c11fa2c3 to your computer and use it in GitHub Desktop.
this crashes in a few different ways on moarvm.
#!/usr/bin/env perl6
use v6;
my int $width = 320;
my int $height = 240;
my int $hwidth = ($width /2).Int;
my int $hheight = ($height/2).Int;
my int $wid = 4;
my (int $xcenter, int $ycenter) = (-1,0);
my $t0 = DateTime.now.Instant;
sub mandelbrot() { }
my $render;
my $c = Channel.new;
my $plotting = start {
for $c.list -> $item {
my ($xcoord, $ycoord, $color) = $item;
plot($render, $xcoord, $ycoord, $color);
}
}
await do for ( 0..$width).pick(*) -> int $xcoord {
start {
for ( 0..$height-1).pick(*) -> int $ycoord {
my $color = (0,0,0);
my $item = ($xcoord, $ycoord, $color);
$c.send($item);
}
}
}
$c.close;
await $plotting;
say DateTime.now.Instant-$t0 ~ " sec(s)";
sub plot($render, $x,$y,$c) {
my ($c1, $c2, $c3) = $c; # XXX
print ".";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment