Skip to content

Instantly share code, notes, and snippets.

@samcv
Created April 8, 2017 07:55
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 samcv/2aac7ec4ad19129365ee95bcb6a4aae4 to your computer and use it in GitHub Desktop.
Save samcv/2aac7ec4ad19129365ee95bcb6a4aae4 to your computer and use it in GitHub Desktop.
my $tA = now; say 'a' x 1000000000 ~ 'b' ~~ /b/; note 'A ' ~ now - $tA;
my $tB = now; say 'a' x 1000000000 ~ 'b' ~~ /aaabcde/; note 'C ' ~ now - $tB;
my $tC = now; say 'a' x 1000000000 ~ 'b' ~~ /abcde/; note 'B ' ~ now - $tC;
# If you have time:
my $var1 = 'a' x 1000000000 ~ 'b'; my $ta = now; use nqp; nqp::index($var1, 'b', 0); note 'a ' ~ now - $ta;
my $var2 = 'a' x 1000000000 ~ 'b'; my $tb = now; use nqp; nqp::index($var2, 'abcde', 0); note 'b ' ~ now - $tb;
my $var3 = 'a' x 1000000000 ~ 'b'; my $tc = now; use nqp; nqp::index($var3, 'aaabcde', 0); note 'c ' ~ now - $tc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment