tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Crowther" <>
Subject RE: Code performance question #2
Date Mon, 07 Aug 2006 16:55:59 GMT
> From: David Kerber [] 
> 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:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message