Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 75948 invoked from network); 7 Aug 2006 16:29:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Aug 2006 16:29:04 -0000 Received: (qmail 89072 invoked by uid 500); 7 Aug 2006 16:28:52 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 89051 invoked by uid 500); 7 Aug 2006 16:28:52 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 89040 invoked by uid 99); 7 Aug 2006 16:28:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Aug 2006 09:28:52 -0700 X-ASF-Spam-Status: No, hits=3.3 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 204.17.65.6 is neither permitted nor denied by domain of dckerber@verizon.net) Received: from [204.17.65.6] (HELO mr02.conversent.net) (204.17.65.6) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Aug 2006 09:28:51 -0700 Received: from [127.0.0.1] (host254.111.41.216.conversent.net [216.41.111.254]) (authenticated bits=0) by mr02.conversent.net (8.13.4/8.13.4) with ESMTP id k77GSSBc024387 for ; Mon, 7 Aug 2006 12:28:29 -0400 (EDT) Message-ID: <44D76A27.5080407@verizon.net> Date: Mon, 07 Aug 2006 12:28:23 -0400 From: David Kerber User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Code performance question #2 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I'm not sure how to "Split it on the &, put it into a suitably keyed structure such as a Map" other than the way I'm doing it already, unless I'm not understanding your suggestion. So I think I need to give a bit more info about how this is used: I can't control the data coming in; it's from a different application which sends this string in an encrypted form over a WAN. After I decrypt the data string, I'm left with the string I describe below. I need to parse out the data from the fields in the string, and then write them out to disk in a different format. There is no other processing done with the data, so I don't need to reference any of them more than once. Therefore I think loading them into an array probably adds more overhead than splitting the string the way I do right now. Is there a more efficient "split" method I could use? Or am I completely missing the point of what you are suggesting? Dave Peter Crowther wrote: >>From: David Kerber [mailto:dckerber@verizon.net] >>It is >>executed for over 2 million data lines per day, so this routine is >>executed over 10 million times per day. >> >> >[snippet of code that parses the line each time elided] > >Opinion: You're optimising the wrong piece of code. > >You're calling this 5 times in quick succession. This means you're >parsing the same string the same way 5 times in quick succession. Split >it on the &, put it into a suitably keyed structure such as a Map (or >even an array if you want the speed and know exactly what your >parameters are) and pass the keyed structure around. That way you only >parse the string once. > > - Peter > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org