Last active
September 13, 2017 01:44
Revisions
-
rockpunk revised this gist
Sep 13, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,12 +2,12 @@ cru@mclappy:~ $ for y in tmp stdin arg; do time for x in {1..100}; do ./junk.php real 0m11.431s user 0m9.040s sys 0m2.011s real 0m11.335s user 0m9.015s sys 0m1.959s real 0m14.142s user 0m11.556s sys 0m2.199s -
rockpunk created this gist
Sep 13, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/usr/bin/env php <?php $n=10; $meth=$argv[1]; if($argv[2]) { $n=$argv[2]; } $str='str'; for($i=0;$i<$n-5;$i++) { $str.="i"; } $str .= "ng"; switch($meth) { case 'arg': system('./junk.py -s ' . $str); break; case 'tmp': $fname = tempnam('/tmp','junk'); $f = fopen($fname,'wb'); fwrite($f, $str); fclose($f); system('./junk.py -f ' . $fname); break; case 'stdin': $f = popen('./junk.py','wb'); fwrite($f, $str); pclose($f); break; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/usr/bin/env python import argparse import os import sys p = argparse.ArgumentParser() p.add_argument('-f') p.add_argument('-s') opts = p.parse_args() f=None if opts.f: f = open(opts.f, 'rb') elif opts.s: s = opts.s else: f = sys.stdin if f: s = f.read() # force some work in mem b = len(''.join(s.upper()[::-1].split())) print "hey, got %s bytes" % b if opts.f: os.unlink(opts.f) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ cru@mclappy:~ $ for y in tmp stdin arg; do time for x in {1..100}; do ./junk.php $y 200000 > /dev/null; done; done real 0m11.431s user 0m9.040s sys 0m2.011s real 0m11.335s user 0m9.015s sys 0m1.959s real 0m14.142s user 0m11.556s sys 0m2.199s