Skip to content

Instantly share code, notes, and snippets.

@cmungall
Created March 30, 2014 01:40
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 cmungall/9865984 to your computer and use it in GitHub Desktop.
Save cmungall/9865984 to your computer and use it in GitHub Desktop.
test diff sizes
#!/usr/bin/perl
my $f = shift @ARGV;
runcmd("save-in-all-formats.sh $f");
our $N=16;
our $ITERATIONS=10;
for (my $iter=1; $iter<= $ITERATIONS; $iter++) {
for (my $i=1; $i<$N; $i++) {
my $x = 2 ** $i;
my $df = "DIFF-$i.owl";
my $cmd = "owljs-remove-random-axioms -n $x -o $df $f";
runcmd($cmd);
runcmd("save-in-all-formats.sh $df");
foreach my $fmt (qw(owl ofn obo ttl omn)) {
my $out = runcmd("diff $df.$fmt $f.$fmt | wc -l");
print STDERR "OUT: $out\n";
if ($out =~ /^\s*(\d+)/) {
print "$fmt\t$i\t$1\t$iter\n";
}
else {
warn($out);
}
}
}
}
exit 0;
sub runcmd {
my $c = shift;
print STDERR "CMD: $c\n";
open(F, "$c|") || die $c;
my $out = join("",<F>);
close(F);
chomp $out;
$out =~ s/^\s+//;
$out =~ s/\s+$//;
return $out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment