Re: Code performance question #2

2006-08-08 Thread David Kerber
Peter Crowther wrote: From: David Kerber [mailto:[EMAIL PROTECTED] Do you think it be more efficient to scan the string once and grab the field values as I get to each field marker? Yes. Yes, the machine is cpu-bound. My 768k data line will spike the cpu to 100% and hold it above

Re: Code performance question #2

2006-08-08 Thread David Kerber
Pid wrote: David Kerber wrote: Pid wrote: 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 da

RE: Code performance question #2

2006-08-08 Thread Peter Crowther
> From: Martin Gainty [mailto:[EMAIL PROTECTED] > Please read > http://www.javaranch.com/newsletter/200401/IntroToCodeCoverage.html > paying particular attention to race conditions, deadly > embraces and basic coverage of Functions Martin, I'm confused - could you just outline how code coverage

Re: Code performance question #2

2006-08-08 Thread Martin Gainty
sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: "Peter Crowther" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Tuesday, August 08, 2006 5:02 AM Subject: RE: Code perfor

RE: Code performance question #2

2006-08-08 Thread Peter Crowther
> From: David Kerber [mailto:[EMAIL PROTECTED] > Do you think > it be more efficient to scan the string once and grab the > field values as I get to each field marker? Yes. > Yes, the machine is cpu-bound. > My 768k data line will spike the cpu to 100% and hold it > above 95% until > the t

Re: Code performance question #2

2006-08-08 Thread Pid
David Kerber wrote: > Pid wrote: > >> 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 >> da

Re: Code performance question #2

2006-08-07 Thread Mark Thomas
David Kerber wrote: > I haven't run a profiler on this code; I've tried, but getting the > configuration figured out has stumped me every time. I have had good results with YourKit. Simple to set up and a nice output that shows where the time is spent. I have used to to investigate reported perfor

Re: Code performance question #2

2006-08-07 Thread David Kerber
Pid wrote: 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 exampl

Re: Code performance question #2

2006-08-07 Thread David Kerber
Peter Crowther wrote: From: David Kerber [mailto:[EMAIL PROTECTED] 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

Re: Code performance question #2

2006-08-07 Thread Pid
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 st

RE: Code performance question #2

2006-08-07 Thread Peter Crowther
> From: David Kerber [mailto:[EMAIL PROTECTED] > 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 t

Re: Code performance question #2

2006-08-07 Thread David Kerber
See my response to Peter; I can't control the format of that data string (it's from a different application). I just need to split out the data fields and store them away in a disk file. Or am I missing the point of your suggestion? Dave Leon Rosenberg wrote: thats ugly, why don't you to

Re: Code performance question #2

2006-08-07 Thread David Kerber
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

RE: Code performance question #2

2006-08-07 Thread Peter Crowther
> From: David Kerber [mailto:[EMAIL PROTECTED] > 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

Re: Code performance question #2

2006-08-07 Thread Leon Rosenberg
thats ugly, why don't you tokenize it into string pairs, store the pairs and works with them? leon On 8/7/06, David Kerber <[EMAIL PROTECTED]> wrote: This code is part of a servlet running in TC 5.5.12, jre ver 1.5.0.6. I use this code to break out individual data fields from a line which is st