This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: String `+' improvement
- From: Per Bothner <per at bothner dot com>
- To: tromey at redhat dot com
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Thu, 29 Nov 2001 17:46:24 -0800
- Subject: Re: String `+' improvement
- References: <87lmgpyswc.fsf@creche.redhat.com>
Tom Tromey wrote:
> I haven't written the ChangeLog entries yet. Before I submit this for
> real, I want to know if people think this is generally a good idea.
It seems worthwhile. Before you do check it in I assume you will
get rid of the unneeded methods (insert, replace, duplicated
ensureCapacity etc) and the 'shared' field.
> It does involve a bit of ugliness in that we copy most of
> StringBuffer's code. However I doubt this is a big deal. I don't
> think the copy will need to change,
Well, there may well be optimizations that are appropriate for both
the real StringBuffer and this version.
For example StringBuffer.append(int) (and corresponding insert)
should be made native and use the _Jv_FormatInt, just
like String.valueOf(int) does. This alloive allocating a temporary
String. One could do the same with the other number->string conversions.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/