lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: bytecount as String and prefix length
Date Tue, 01 Nov 2005 17:39:39 GMT
Marvin Humphrey wrote:
> I think it's time to throw in the towel.

Please don't give up.  I think you're quite close.

I would be careful using CharBuffer instead of char[] unless you're sure 
all methods you call are very efficient.  You could try avoiding 
CharBuffer by adding something (ugly) like an int[]charLength parameter 
where the length is stored, then simply return the char[], in case you 
had to re-allocate.

Using an exception for control flow is not only considered bad style, 
but is also a performance pitfall.  A catch that is unused is free, but 
catching and throwing exceptions is expensive.

A complete diff would make it easier to see if there's something else 
which may be slowing things, e.g., inadvertantly allocating something 
for each call.  Also, someone else could try to tune it more.

Have you profiled this?  Sun's built-in profiler can be useful.  It can 
give you allocation counts, so you can see if you're allocating 
significantly more objects.  It also gives call counts (in the old 'java 
-prof' mode) which are useful.  It slows things so much that I find 
relative performance of methods to be nearly worthless, but call and 
allocation counts can point out problems.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message