From a98a723a4b6eecae7d16582dd313adb5fbad29eb Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 29 Dec 2004 15:17:59 +0000 Subject: [PATCH] another speedup (7845.71/s) git-svn-id: file:///home/dpavlin/svn/Biblio-Isis/trunk@8 4670fa4d-42ec-0310-ab5b-a66af6943492 --- IsisDB.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/IsisDB.pm b/IsisDB.pm index 13f173b..2733dad 100644 --- 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); -- 2.20.1