Skip to content

Instantly share code, notes, and snippets.

@Skarsnik
Created July 26, 2017 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Skarsnik/6adfba55ff9b0d179a8ffee923112393 to your computer and use it in GitHub Desktop.
Save Skarsnik/6adfba55ff9b0d179a8ffee923112393 to your computer and use it in GitHub Desktop.
skarsnik@vps300582:~/perl6/benchmark$ ./rakudo-2017.05/install/bin/perl6 -I p6-linux-proc-statm/lib/ ../testshell.p6 shell
Before shell call : 65.996 kb
html is 258974 chars
After shell call : 66.860 kb
After sleep 5 : 66.860 kb
skarsnik@vps300582:~/perl6/benchmark$ ./rakudo-2017.07/install/bin/perl6 -I p6-linux-proc-statm/lib/ ../testshell.p6 shell
Before shell call : 78.812 kb
html is 258974 chars
After shell call : 106.104 kb
After sleep 5 : 107.192 kb
use Linux::Proc::Statm;
sub mem($a) {
say $a ~ get-statm<data>.flip.comb(/.**1..3/).join('.').flip ~ ' kb';
}
mem("Before shell call : ");
my $html;
if @*ARGS[0] eq "qqx" {
$html = qqx{wget -o /dev/null -O - https://www.fimfiction.net/bookshelf/149291/};
}
if @*ARGS[0] eq "shell" {
my $proc = shell "wget -o /dev/null -O - https://www.fimfiction.net/bookshelf/149291/", :out;
$html = $proc.out.slurp;
}
if @*ARGS[0] eq "run" {
my $proc = run "wget", "-o", "/dev/null", "-O", "-", "https://www.fimfiction.net/bookshelf/149291/", :out;
$html = $proc.out.slurp;
}
say "html is " ~ $html.chars ~ " chars";
mem("After shell call : ");
sleep 5;
mem("After sleep 5 : ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment