Loading ...
Sorry, an error occurred while loading the content.

2688Performance problem with soaplite

Expand Messages
  • Dave Kimberley
    Jun 9, 2003
    • 0 Attachment
      I am using the following code to process a SOAP message that contains
      2500 Employees and it runs very slowly, with small numbers of Employees
      there is not a problem.

      Here is the relevant code:

      ...

      my $MessageDetail;
      printf("%d: Getting message detail\n", time() - $t);
      ($MessageDetail, $TicketBook) = $soap->GetMessageDetail(\$TicketBook,
      \$MessageID);
      printf("%d: Got message detail\n", time() - $t);
      my $MessageDetailSOM = $soap->call;
      printf("%d: Got message detail SOM\n", time() - $t);
      for (my $i = 1; my $Employee =
      $MessageDetailSOM->match("//GovTalkMessage/Body/DigitalMail/MessageBody/CodingNoticeP9/[$i]");
      $i++)
      {
      printf("%d: In loop at start %d\n", time() - $t, $i);
      if ($Employee->dataof()->name eq 'Employee')
      {
      my $p9;

      ($p9->{'NINO'}, $p9->{'Suffix'}) =
      nino_split(trim($Employee->valueof('NINO')));
      $p9->{'membno'} = trim($Employee->valueof('WorksNumber'));
      if ($p9->{'membno'} =~ /([0-9]*)/)
      {
      $p9->{'membno'} = $1;
      }
      else
      {
      $p9->{'membno'} = '';
      }
      $p9->{'EffectiveDate'} = trim($Employee->valueof('EffectiveDate'));
      $p9->{'Name'} = trim($Employee->valueof('Name/Forename'));
      ($p9->{'Title'}, $p9->{'Initials'}, $p9->{'Surname'}) =
      name_split($p9->{'Name'});
      my $tax = $Employee->dataof('CodingUpdate/TaxCode');
      $p9->{'TaxCode'} = tax_code_expand(trim($tax->value));
      if ($p9->{'TaxCode'} =~ m/^(D0|NT)$/)
      {
      $p9->{'Week1Month1Indicator'} = 1;
      }
      else
      {
      $p9->{'Week1Month1Indicator'} =
      $tax->attr->{'Week1Month1Indicator'};
      if (defined $p9->{'Week1Month1Indicator'})
      {
      if ($p9->{'Week1Month1Indicator'} eq 'X')
      {
      $p9->{'Week1Month1Indicator'} = 1;
      }
      else
      {
      print 'ERROR: Unrecognized Week1Month1Indicator = '
      . $p9->{'Week1Month1Indicator'} . "\n";
      $p9->{'Week1Month1Indicator'} = 0;
      }
      }
      else
      {
      $p9->{'Week1Month1Indicator'} = 0;
      }
      }
      ProcessP9($p9);
      }
      printf("%d: In loop at end %d\n", time() - $t, $i);
      }

      ...

      Here are the times in seconds:

      13: Getting message detail
      60: Got message detail
      60: Got message detail SOM
      95: In loop at start 1
      95: In loop at end 1
      130: In loop at start 2
      130: In loop at end 2

      The times indicate that the majority of the time is spent doing the
      match in the for statement. Is there a better way of doing this?

      Thanks

      Dave
    • Show all 3 messages in this topic