build.sh: pass OPTS also to linking stage, so -static can be passed
[rofl0r-memcpy-test.git] / compare.pl
blob2a26871a6a381576309279617b50c5b3ab13b16d
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use File::Slurp;
6 my $code1 = $ARGV[0] or die;
7 my $code2 = $ARGV[1] or die;
9 my $tmp = "/tmp/memcpy.txt";
11 print "speed comparison - $code1 vs $code2\n";
12 print "CC=$ENV{CC} OPTS=$ENV{OPTS}\n";
14 system("./build.sh $code1 && ./test > $tmp.1") and die;
15 system("./build.sh $code2 && ./test > $tmp.2") and die;
17 my @file1 = read_file("$tmp.1") or die;
18 my @file2 = read_file("$tmp.2") or die;
20 sub getvals {
21 my $x = shift;
22 my @a = split /\t/, $x;
23 return $a[0], $a[1];
27 for(@file1) {
28 my ($size, $val) = getvals($_);
29 my $s = shift(@file2);
30 my ($size2, $val2) = getvals($s);
31 exit 1 if($size != $size2);
32 chomp($val);
33 chomp($val2);
34 print "size: $size\t$val\t$val2\n";