Title: [jdjlist] RE: Slow: string += string
Sorry I was indeed wrong:
 
    /**
     * Constructs a string buffer with no characters in it and an
     * initial capacity of 16 characters.
     */
    public StringBuffer() {
 this(16);
    }
-----Original Message-----
From: Greg Nudelman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 1:43 PM
To: JDJList
Subject: [jdjlist] RE: Slow: string += string

From:

http://www.precisejava.com/javaperf/j2se/StringAndStringBuffer.htm

The default behavior of StringBuffer:

StringBuffer maintains a character array internally.When you create StringBuffer with default constructor StringBuffer() without setting initial length, then the StringBuffer is initialized with 16 characters. The default capacity is 16 characters.

Also others:

http://www.google.com/search?q=StringBUffer+default+size+16&hl=en&lr=&ie=UTF-8&oe=UTF-8

-----Original Message-----
From: Yan, Hong [IT] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 10:33 AM
To: JDJList
Subject: [jdjlist] RE: Slow: string += string

Last time I checked the source code of String, the default value is 10. Or I am wrong?
 
Jeff
-----Original Message-----
From: Greg Nudelman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 1:26 PM
To: JDJList
Subject: [jdjlist] RE: Slow: string += string

That's a very good point:

> String myString = new StringBuffer(256)

Java's default of 16 is WAY too small for almost anything. Java should in my opinion do all this higher-performance plumbing for you automatically, like Perl does.  But of course it can't since Strings are immutable objects...

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

Reply via email to