This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: String `+' improvement


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]