On Thu, Mar 16, 2000 at 11:25:26AM +0100, Ralf Nieser wrote:
> >21 case '"': buf.append( "\\\"" ); break; // !
> >22 case '\\': buf.append( "\\\\" ); break; // !
> >23 default: buf.append( ch ); break;
>
> 2. :line (21,22)
> If you look at the source of java.lang.StringBuffer it seems that
> buf.append( '\\' ).append( '\"' ); is cheaper than a
> buf.append( "\\\"" );
Regardless of the append implimentation of append, appending a char
instead of a string saves you an object creation as well. Since this
code will create a new String object for each append.
Brad
--
--- There are two kinds of knowledge, you either know the answer or
you know where to find it
-Kane, Johnson, and anonymous
- Wanted: Efficient String Escape Method Paul Kinnucan
- Re: Wanted: Efficient String Escape Method Mark Gibson
- Re: Wanted: Efficient String Escape Method Paul Kinnucan
- Re: Wanted: Efficient String Escape Method Ralf Nieser
- Re: Wanted: Efficient String Escape Method Brad Giaccio
- Re: Wanted: Efficient String Escape Method Phillip Lord
- Re: Wanted: Efficient String Escape Me... Brad Giaccio
- Re: Wanted: Efficient String Escap... Phillip Lord
- Re: Wanted: Efficient String Escap... Mark Gibson
- Re: Wanted: Efficient String E... Silvio Macedo
- Re: Wanted: Efficient String E... Silvio Macedo
- RE: Wanted: Efficient String Escape Method David Hay
- RE: Wanted: Efficient String Escape Method Paul Kinnucan
- Re: Wanted: Efficient String Escape Method Paul Kinnucan
