Last active
December 9, 2017 18:24
-
-
Save MattOates/af2b09881b22d3e994b2f7b5d56ae649 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env perl6 | |
use v6; | |
# Test files produced with mkfile -n 10m 10m for each file size | |
my @file_sizes = <1m 10m 100m 1g 10g>; | |
my @read_sizes = <1024 65536>; | |
my %langs = ( ruby => {cmd => "\{time -p ruby -e 'while buf = STDIN.read(%d) do end' < %s\} 2>&1"}, | |
perl5 => {cmd => "\{time -p perl -e 'while(read(STDIN,\$buf,%d)) {}' < %s\} 2>&1"}, | |
perl6 => {cmd => "\{time -p perl6 -e 'while (my \$buf = \$*IN.read(%d)) {}' < %s\} 2>&1"}); | |
# For all the combos execute each language | |
for @file_sizes X %langs.keys X @read_sizes -> ($file, $lang, $chunk) { | |
my $cmd = sprintf %langs{$lang}<cmd>, $chunk, $file; | |
say $cmd; | |
my @output = q:x/$cmd/.lines; | |
say @output; | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment