tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kerber <>
Subject Re: Code performance question #2
Date Mon, 07 Aug 2006 16:28:23 GMT
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?


Peter Crowther wrote:

>>From: David Kerber [] 
>>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:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message