Skip to content

Instantly share code, notes, and snippets.

@moritz
Created January 30, 2015 19:09
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 moritz/8ceacf454fb1f5af9461 to your computer and use it in GitHub Desktop.
Save moritz/8ceacf454fb1f5af9461 to your computer and use it in GitHub Desktop.
rakudo pod parsing slowness when '=end pod' is missing
use v6;
sub timeit(Int $lines-after) {
my $preamble = qq[=begin code\n];
my $str = join "\n", $preamble, "Some more happy, happy lines of B<pod>\n\n including code\n\n" xx $lines-after;
my $before = now;
try EVAL qq[=begin pod\n\n$str\n\n\=end pod\n"];
my $after = now;
return $after - $before;
}
for ^50 -> $t {
given $t * 1 {
say join "\t", $_, timeit($_);
}
}
# output:
#
# 0 0.010546
# 1 0.0218128
# 2 0.10669325
# 3 0.7040623
# 4 5.6502557
# 5 45.8098792
# (here I lost patience)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment