[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HTTPAPI XML parsing performance
   Looks like I have resolved the performance issue and it is not down to
   exPat or the HTTP API...
   It would appear that all the %trimr(utag) statements combined with the
   conversion to uppercase took all the time. When simply comparing the
   field "tag" to the literal of the correct case, the result is a
   sub-second response. Similarly, a much larger file which previously
   took in excess of 30 seconds is now processed in around 2 seconds.
   Best wishes to SK for a speedy & full recovery.
   ---------------------------------
   Michael
   On 21 January 2013 16:44, Michael Rushton
   <[1]michael.rushton@xxxxxxxxx> wrote:
   I have searched my mailing list for an answer to this but, alas, found
   nothing. If I have overlooked an article on this, feel free to simply
   point me at it.
   I am successfully extracting data from an XML file in the IFS however I
   have a question concerning its performance. The IFS file itself is
   approximately 32kb, contains around 1500 tags and takes about 12
   seconds to parse. I am using Expat to do the parsing.
   OS/400 version is V5R3M0
   LIBHTTP is 1.25 Beta 1
   The STMF has a CCSID of 819 although I have tried it using 1252 with no
   noticeable difference.
   Am I being overly optimistic in thinking that this should be processed
   in two or three seconds ?
   Any pointers as to how I might improve the execution time or where I
   should look will be gratefully received.
   Code snippets:
   The data structure used to store the data...
    * DS for parsed XML file
   D xVehData        ds                  qualified
    * ... Header
   D  Token                        20A   varying
   D  partnerCode                  20A   varying
   D  serviceID                    20A   varying
   D  userID                       20A   varying
   D  password                     20A   varying
   D  client                       20A   varying
   D  customer                     20A   varying
    * ... Vehicle Master
   D  regNumber                    20A   varying
   D  vin                          20A   varying
   D  firstRegDate                 10A   varying
   etc
   The code used to parse the XML...
   if (http_parse_xml_stmf( ifsObj
                          : HTTP_XML_CALC
                          : *null
                          : %paddr(incoming)
                          : %addr(xVehData) ) < *zero);
   // Notify user of error
   else;
   // Populate screen fields
   endif;
   The "incoming" procedure has the following structure...
   upath = %trimr(uppify(path));  // Uppercase
   utag  =        uppify(tag)  ;  // conversion
   // Header section - - - - - - - - - - - -
   if (%scan(@HEADER: upath) > *zero);
      select;
         when %trimr(utag) = 'TOKEN';
            xVehData.Token = %trimr(value);
         when %trimr(utag) = 'PARTNERCODE';
            xVehData.PartnerCode = %trimr(value);
         when %trimr(utag) = 'ISSERVICEID';
            xVehData.ServiceID = %trimr(value);
         when %trimr(utag) = 'USERID';
            xVehData.UserID = %trimr(value);
         when %trimr(utag) = 'PASSWORD';
            xVehData.Password = %trimr(value);
         when %trimr(utag) = 'CLIENT';
            xVehData.Client = %trimr(value);
         when %trimr(utag) = 'CUSTOMERNUM';
            xVehData.Customer = %trimr(value);
      endsl;
   etc
   ---------------------------------
   Michael
References
   1. mailto:michael.rushton@xxxxxxxxx
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------