This file is indexed.

/usr/share/doc/libswiss-perl/examples/benchmark.pl is in libswiss-perl 1.67-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/perl

# *************************************************************
#
# Purpose:
# Run a Perl benchmark using the Swissknife modules.
#
# Usage: 
# benchmark.pl -file filename -repeats int
#
# *************************************************************

# ** Initialisation

use vars qw($opt_file $opt_repeats $tmpsource $tmptarget $opt_debug $opt_warn);
use SWISS::Entry;
use Benchmark;
use Getopt::Long;
use strict;
    
# * Global constants
# Read an entire record at a time
$/ = "\/\/\n";

$opt_debug = 0;
$opt_warn = 1;

$tmpsource = '/tmp/perlBenchSource' . $$;
$tmptarget = '/tmp/perlBenchTarget' . $$;


# * Variables
my ($codeStart, $codeStop, $code);

# * Read options
&GetOptions("file=s", "repeats=i");

unless ($opt_file && $opt_repeats =~ /\A\d+\Z/) {
  die "Usage: benchmark.pl -file filename -repeats int\n";
};

system "cp $opt_file $tmpsource";

# ** Main

print "*** Swissknife Benchmark and Test suite *** \n";

$codeStart = '
  open (IN, $tmpsource) || die "Could not open $opt_file";
  open (ZERO, ">/dev/null");
  open (OUT, ">$tmptarget");
  while (<IN>) {';

$codeStop = '};
  close IN;
  close OUT;
';

# Read only
$code = '$entry = SWISS::Entry->fromText($_);';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read only:             ');

# Read and write entries to /dev/null
$code = '
   $entry = SWISS::Entry->fromText($_);
   print ZERO $entry->toText;';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read/Write NULL:       ');

# Read and write entries to /tmp
$code = '
   $entry = SWISS::Entry->fromText($_);
   print OUT $entry->toText;';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read/Write:            ');

# Add AC
$code = '
   $entry = SWISS::Entry->fromText($_);
   $entry->ACs->add(Q12345);
   print OUT $entry->toText;';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read/Write/addAC:      ');


# Read and write entries, fullparse
$code = '
   $entry = SWISS::Entry->fromText($_,1);
   print OUT $entry->toText;';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read/Write/Fullparse:  ');

# Force update
$code = '
   $entry = SWISS::Entry->fromText($_,1);
   $entry->update(1);
   print OUT $entry->toText;';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read/Write/Fp/Update:  ');


# Compare the entry to itself
$code = '
   $entry = SWISS::Entry->fromText($_);
   $entry->equal($entry);';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read/equals:           ');

# Complex modifications of entries
$code = '
$entry = SWISS::Entry->fromText($_);
$entry->ACs->add("Q1", "Q2");
$entry->IDs->list([]);
$entry->IDs->add("NEW_ID");
$pfs = $entry->Stars->pf;
$pfs->add("PFAM test line");
$entry->Stars->pf($pfs);
$entry->Stars->fl->add("TESTFLAG");
$entry->DRs->del("PFAM");
$entry->OCs;
$entry->DRs->del("EMBL");
$entry->Stars->translate;
print OUT $entry->toText;';
timethis ($opt_repeats, $codeStart . $code . $codeStop, 'Read/Write/Modify:     ');