another speedup (7845.71/s)
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 29 Dec 2004 15:17:59 +0000 (15:17 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 29 Dec 2004 15:17:59 +0000 (15:17 +0000)
git-svn-id: file:///home/dpavlin/svn/Biblio-Isis/trunk@8 4670fa4d-42ec-0310-ab5b-a66af6943492

IsisDB.pm

index 13f173b..2733dad 100644 (file)
--- a/IsisDB.pm
+++ b/IsisDB.pm
@@ -276,14 +276,17 @@ print ("Error: The MFN:".$mfn." is not found in MST(".$value.")");
        my @FieldLEN;
        my @FieldTAG;
 
+       read($self->{'fileMST'}, $buff, 6 * $NVF);
+
+       my $fld_len = 0;
+
        for (my $i = 0 ; $i < $NVF ; $i++) {
 
 #              $TAG=$self->Read16($fileMST);
 #              $POS=$self->Read16($fileMST);
 #              $LEN=$self->Read16($fileMST);
 
-               read($self->{'fileMST'}, $buff, 6);
-               my ($TAG,$POS,$LEN) = unpack("sss", $buff);
+               my ($TAG,$POS,$LEN) = unpack("sss", substr($buff,$i * 6, 6));
 
                print "TAG: $TAG POS: $POS LEN: $LEN\n" if ($self->{debug});
 
@@ -300,16 +303,18 @@ print ("Error: The MFN:".$mfn." is not found in MST(".$value.")");
                push @FieldTAG,$TAG;
                push @FieldPOS,$POS;
                push @FieldLEN,$LEN;
+
+               $fld_len += $LEN;
        }
 
        # Get Variable Fields
 
        delete $self->{record};
 
+       read($self->{'fileMST'},$buff,$fld_len);
+
        for (my $i = 0 ; $i < $NVF ; $i++) {
-               my $rec;
-               read($self->{'fileMST'},$rec,$FieldLEN[$i]);
-               push @{$self->{record}->{$FieldTAG[$i]}}, $rec;
+               push @{$self->{record}->{$FieldTAG[$i]}}, substr($buff,$FieldPOS[$i],$FieldLEN[$i]);
        }
        close(fileMST);