On Jun 1, 2010, at 2:29 , David Dabbs wrote:
Even with the extra call to access the offset, I would think there
would be some advantage to not making the data copies, which
generate garbage cruft.
However, the way I am doing it doesn't generate any garbage: I keep a
temporary char buffer around to use with String.getChars(). The
cost is copying chars VS using reflection to access two fields. With
the small strings I tested (average ~30 bytes per string), the copy is
a bit cheaper than the reflection access. I assume that for larger
strings, the reflection approach will probably be better.
Which reminds me: I really need to test this with larger strings to
make sure it isn't dog slow in that case.
I seem to remember you saying that using an Encoder/Decoder didn't
pay off when the number of strings to en/decode was small. Did the
same hold true when using a ThreadLocal?
From memory, the ThreadLocal appears to be very cheap, and not make
much performance difference, but I should double check this as well.
You received this message because you are subscribed to the Google Groups "Protocol
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at