Skip to content

Instantly share code, notes, and snippets.

@timo
Created July 23, 2013 18:38
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/a493f5fbb80e0f298f92 to your computer and use it in GitHub Desktop.
Save timo/a493f5fbb80e0f298f92 to your computer and use it in GitHub Desktop.
this blows up to 1.8gb in size after the sleep, while it is at about 0.6 before.
#!/usr/bin/env perl6
use v6;
# This script isn't in bin/ because it's not meant to be installed.
BEGIN say 'Initializing ...';
sub recursive-dir($dir) {
my @todo = $dir;
gather while @todo {
my $d = @todo.shift;
for dir($d) -> $f {
if $f.f {
take $f;
}
else {
@todo.push($f.path);
}
}
}
}
sub MAIN() {
say 'Reading lib/ ...';
sleep(10); # sleep to u
my @source = recursive-dir('lib').grep(*.f).grep(rx{\.pod$});
@source .= map: {; .path.subst('lib/', '').subst(rx{\.pod$}, '').subst(:g, '/', '::') => $_ };
say @source.elems;
sleep(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment