tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid...@pidster.com>
Subject Re: Code performance question #2
Date Mon, 07 Aug 2006 17:04:27 GMT
here's another obvious question:

if you're in a servlet, and you're getting an & separated string from
somewhere, where is the "somewhere" that you're getting it from?

does the servlet activate and collection the data somehow, or does the
data get sent to the servlet (in, for example the query string)?





Peter Crowther wrote:
>> From: David Kerber [mailto:dckerber@verizon.net] 
>> Is there a more efficient "split" method I could use?  Or am I 
>> completely missing the point of what you are suggesting?
> 
> I think you've slightly missed the point.  I assume you're calling your function 5 times,
each with a different field name that you want out of it.  You're then invoking string handling
functions on the entire decrypted string 5 times, each time going through the bytes to extract
the piece you need.  In the process, you traverse bytes you don't need several times.  My
suggestion is that you tokenise this *once*, and hence only pay the string-handling overhead
once.  Then you get all the parameters out of the same tokenised version.
> 
> However, if the next thing you do is to write this to disk, I am even more convinced
that you're optimising the wrong piece of code as the disk I/O is likely to take vastly more
instructions than the string parse.
> 
> These may be naïve questions, but I'll ask them anyway.  How have you identified these
two pieces of code as the targets for optimisation?  What profiler have you used, under what
conditions?  What proportion of your overall CPU budget is taken by these two snippets of
code?  Is the machine CPU-bound in the first place, or is the bottleneck elsewhere?  If these
are the worst culprits in your app, I'll be very surprised.
> 
> 		- 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
> 
> 
> 


---------------------------------------------------------------------
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


Mime
View raw message